diff options
Diffstat (limited to 'lib/libc/stdlib/strtoq.c')
-rw-r--r-- | lib/libc/stdlib/strtoq.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/libc/stdlib/strtoq.c b/lib/libc/stdlib/strtoq.c index b31cca4..a5720df 100644 --- a/lib/libc/stdlib/strtoq.c +++ b/lib/libc/stdlib/strtoq.c @@ -56,7 +56,7 @@ strtoq(nptr, endptr, base) { register const char *s; register u_quad_t acc; - register int c; + register unsigned char c; register u_quad_t qbase, cutoff; register int neg, any, cutlim; @@ -109,6 +109,8 @@ strtoq(nptr, endptr, base) cutlim = cutoff % qbase; cutoff /= qbase; for (acc = 0, any = 0;; c = *s++) { + if (!isascii(c)) + break; if (isdigit(c)) c -= '0'; else if (isalpha(c)) |