diff options
author | Ray Lai <ray@cvs.openbsd.org> | 2006-11-02 18:19:31 +0000 |
---|---|---|
committer | Ray Lai <ray@cvs.openbsd.org> | 2006-11-02 18:19:31 +0000 |
commit | 27566edf177012cc7b0e5ae2a155342b3820bd36 (patch) | |
tree | 99c910bd11df9d76c0d1c60e2b1a6a9449d62c03 /games/quiz/quiz.c | |
parent | 745bbe97058998e62c44685f6958ed770d0f8dd4 (diff) |
Don't check buf[strlen(buf) - 1] on empty strings.
OK moritz@.
Diffstat (limited to 'games/quiz/quiz.c')
-rw-r--r-- | games/quiz/quiz.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/games/quiz/quiz.c b/games/quiz/quiz.c index 665e93bc59b..13bac941945 100644 --- a/games/quiz/quiz.c +++ b/games/quiz/quiz.c @@ -1,4 +1,4 @@ -/* $OpenBSD: quiz.c,v 1.16 2004/07/10 07:26:23 deraadt Exp $ */ +/* $OpenBSD: quiz.c,v 1.17 2006/11/02 18:19:30 ray Exp $ */ /* $NetBSD: quiz.c,v 1.9 1995/04/22 10:16:58 cgd Exp $ */ /*- @@ -44,7 +44,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)quiz.c 8.3 (Berkeley) 5/4/95"; #else -static char rcsid[] = "$OpenBSD: quiz.c,v 1.16 2004/07/10 07:26:23 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: quiz.c,v 1.17 2006/11/02 18:19:30 ray Exp $"; #endif #endif /* not lint */ @@ -133,7 +133,8 @@ get_file(const char *file) while ((lp = fgetln(fp, &len)) != NULL) { if (lp[len - 1] == '\n') --len; - if (qp->q_text && qp->q_text[strlen(qp->q_text) - 1] == '\\') + if (qp->q_text && qp->q_text[0] != '\0' && + qp->q_text[strlen(qp->q_text) - 1] == '\\') qp->q_text = appdstr(qp->q_text, lp, len); else { if ((qp->q_next = malloc(sizeof(QE))) == NULL) |