diff options
author | ache <ache@FreeBSD.org> | 1995-08-01 22:04:57 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 1995-08-01 22:04:57 +0000 |
commit | 0548e292bd978f210f0f235daf02b3ab3d37c85c (patch) | |
tree | 75941c22b50b0607c05699d1ca48e547df05dbc8 /lib/libc/stdlib/strtoq.c | |
parent | d3cbf043e9ca0d819b79c25bf8e95572e5340a54 (diff) | |
download | FreeBSD-src-0548e292bd978f210f0f235daf02b3ab3d37c85c.zip FreeBSD-src-0548e292bd978f210f0f235daf02b3ab3d37c85c.tar.gz |
Similar changes like in strtol, all this family is VERY broken
in 8bit environment (isalpha at the end of digits)
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)) |