From: Joel E. Denny Date: Tue, 31 Oct 2006 22:24:57 +0000 (+0000) Subject: * src/getargs.c (flags_argmatch): Don't cause segmentation fault for X-Git-Tag: v2.3b~251 X-Git-Url: https://git.saurik.com/bison.git/commitdiff_plain/ba7560e26bfa2f5a340545830d46e0437fcb701a * src/getargs.c (flags_argmatch): Don't cause segmentation fault for empty subargument list. For example: `bison --warnings= parser.y'. --- diff --git a/ChangeLog b/ChangeLog index 583d8eb8..d64fa6bc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-10-31 Joel E. Denny + + * src/getargs.c (flags_argmatch): Don't cause segmentation fault for + empty subargument list. For example: `bison --warnings= parser.y'. + 2006-10-21 Joel E. Denny * data/push.c, data/yacc.c: Make sure there's a newline at the end of diff --git a/src/getargs.c b/src/getargs.c index 52f97e17..94d24329 100644 --- a/src/getargs.c +++ b/src/getargs.c @@ -91,15 +91,15 @@ flags_argmatch (const char *option, if (args) { args = strtok (args, ","); - do + while (args) { int value = XARGMATCH (option, args, keys, values); if (value == 0) *flags = 0; else *flags |= value; + args = strtok (NULL, ","); } - while ((args = strtok (NULL, ","))); } else *flags = ~0;