diff options
author | Ray Lai <ray@cvs.openbsd.org> | 2006-12-06 05:03:30 +0000 |
---|---|---|
committer | Ray Lai <ray@cvs.openbsd.org> | 2006-12-06 05:03:30 +0000 |
commit | 9304d12ab0848c8f804d5bfc4d3007b8b1272e79 (patch) | |
tree | 5ce25c6b231f9bf780f055229386237761a47a9b /usr.bin/lex/initscan.c | |
parent | 2b4826057532ca32d494f8861b3de6b27f954a41 (diff) |
Don't access buf[strlen(buf) - 1] for zero-length strings.
OK jaredy@.
Diffstat (limited to 'usr.bin/lex/initscan.c')
-rw-r--r-- | usr.bin/lex/initscan.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/usr.bin/lex/initscan.c b/usr.bin/lex/initscan.c index 1b5c39a7db3..1de99680840 100644 --- a/usr.bin/lex/initscan.c +++ b/usr.bin/lex/initscan.c @@ -1,10 +1,10 @@ -/* $OpenBSD: initscan.c,v 1.10 2003/06/04 17:34:44 millert Exp $ */ +/* $OpenBSD: initscan.c,v 1.11 2006/12/06 05:03:29 ray Exp $ */ #line 2 "scan.c" /* A lexical scanner generated by flex */ /* Scanner skeleton version: - * $Header: /cvs/OpenBSD/src/usr.bin/lex/initscan.c,v 1.10 2003/06/04 17:34:44 millert Exp $ + * $Header: /cvs/OpenBSD/src/usr.bin/lex/initscan.c,v 1.11 2006/12/06 05:03:29 ray Exp $ */ #define FLEX_SCANNER @@ -1277,7 +1277,7 @@ char *yytext; * PURPOSE. */ -/* $Header: /cvs/OpenBSD/src/usr.bin/lex/initscan.c,v 1.10 2003/06/04 17:34:44 millert Exp $ */ +/* $Header: /cvs/OpenBSD/src/usr.bin/lex/initscan.c,v 1.11 2006/12/06 05:03:29 ray Exp $ */ #include "flexdef.h" #include "parse.h" @@ -2052,7 +2052,8 @@ YY_RULE_SETUP #line 279 "scan.l" { strlcpy( nmstr, yytext + 1, sizeof nmstr ); - nmstr[strlen( nmstr ) - 1] = '\0'; + if (nmstr[strlen(nmstr) - 1] == '"') + nmstr[strlen(nmstr) - 1] = '\0'; return NAME; } YY_BREAK |