From: Todd C. Miller Date: Thu, 31 Mar 2011 16:49:13 +0000 (-0400) Subject: Avoid using pre or post increment in a parameter to a ctype(3) X-Git-Tag: SUDO_1_7_6~8 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=df8f1be5c9606494f436a867cf786c1793cf9147;p=sudo Avoid using pre or post increment in a parameter to a ctype(3) function as it might be a macro that causes the increment to happen more than once. --HG-- branch : 1.7 --- diff --git a/toke.c b/toke.c index f6e8b8879..f7ae580d0 100644 --- a/toke.c +++ b/toke.c @@ -1993,9 +1993,9 @@ YY_RULE_SETUP for (n = 0; isblank((unsigned char)yytext[n]); n++) continue; n += sizeof("Defaults") - 1; - if ((deftype = yytext[n]) != '\0') { - while (isblank((unsigned char)yytext[++n])) - continue; + if ((deftype = yytext[n++]) != '\0') { + while (isblank((unsigned char)yytext[n])) + n++; } BEGIN GOTDEFS; switch (deftype) { diff --git a/toke.l b/toke.l index ee56a6d04..731637963 100644 --- a/toke.l +++ b/toke.l @@ -303,9 +303,9 @@ DEFVAR [a-z_]+ for (n = 0; isblank((unsigned char)yytext[n]); n++) continue; n += sizeof("Defaults") - 1; - if ((deftype = yytext[n]) != '\0') { - while (isblank((unsigned char)yytext[++n])) - continue; + if ((deftype = yytext[n++]) != '\0') { + while (isblank((unsigned char)yytext[n])) + n++; } BEGIN GOTDEFS; switch (deftype) {