summaryrefslogtreecommitdiff
path: root/libc/stdio
diff options
context:
space:
mode:
authorManuel Novoa III <mjn3@codepoet.org>2002-05-10 20:58:35 +0000
committerManuel Novoa III <mjn3@codepoet.org>2002-05-10 20:58:35 +0000
commitd2be3a1d010ea7e953d15a2e705373735723c06e (patch)
treec3e114e88ff0fca4a590e3b2b7aeeb705db1c494 /libc/stdio
parentb5bbbc0f5f2c2c36c56249c7b2e305eb78cab7e3 (diff)
Protect against ctype macros.
Diffstat (limited to 'libc/stdio')
-rw-r--r--libc/stdio/scanf.c10
1 files changed, 6 insertions, 4 deletions
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) {