From: Todd C. Miller Date: Thu, 31 Mar 2011 16:48:01 +0000 (-0400) Subject: Avoid using pre or post increment in a parameter to a ctype(3) X-Git-Tag: SUDO_1_8_1~25^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ca32055fd8ac633ec9c3746c432f74acef1cfa0e;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. --- diff --git a/plugins/sudoers/toke.c b/plugins/sudoers/toke.c index 2aeb0f84e..22992bf32 100644 --- a/plugins/sudoers/toke.c +++ b/plugins/sudoers/toke.c @@ -1992,9 +1992,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/plugins/sudoers/toke.l b/plugins/sudoers/toke.l index d70b1c30d..9e1cdc12d 100644 --- a/plugins/sudoers/toke.l +++ b/plugins/sudoers/toke.l @@ -302,9 +302,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) {