From d2be3a1d010ea7e953d15a2e705373735723c06e Mon Sep 17 00:00:00 2001 From: Manuel Novoa III Date: Fri, 10 May 2002 20:58:35 +0000 Subject: Protect against ctype macros. --- libc/stdio/scanf.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'libc/stdio/scanf.c') diff --git a/libc/stdio/scanf.c b/libc/stdio/scanf.c index a5e0d412c..96286d926 100644 --- a/libc/stdio/scanf.c +++ b/libc/stdio/scanf.c @@ -346,8 +346,9 @@ va_list ap; goto nextfmt; } if (p-spec > 3) { /* skip white space if not c or [ */ - while (isspace(scan_getc_nw(&sc))) - {} + do { + i = scan_getc_nw(&sc); + } while (isspace(i)); scan_ungetc(&sc); } if (p-spec < 5) { /* [,c,s - string conversions */ @@ -588,8 +589,9 @@ va_list ap; /* Unrecognized specifier! */ goto RETURN_cnt; } if (isspace(*fmt)) { /* Consume all whitespace. */ - while (isspace(scan_getc_nw(&sc))) - {} + do { + i = scan_getc_nw(&sc); + } while (isspace(i)); } else { /* Match the current fmt char. */ matchchar: if (scan_getc_nw(&sc) != *fmt) { -- cgit v1.2.3