summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdlib/strtouq.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/stdlib/strtouq.c')
-rw-r--r--lib/libc/stdlib/strtouq.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/libc/stdlib/strtouq.c b/lib/libc/stdlib/strtouq.c
index cc62a07..16dda0b 100644
--- a/lib/libc/stdlib/strtouq.c
+++ b/lib/libc/stdlib/strtouq.c
@@ -56,7 +56,7 @@ strtouq(nptr, endptr, base)
{
register const char *s = nptr;
register u_quad_t acc;
- register int c;
+ register unsigned char c;
register u_quad_t qbase, cutoff;
register int neg, any, cutlim;
@@ -70,7 +70,7 @@ strtouq(nptr, endptr, base)
if (c == '-') {
neg = 1;
c = *s++;
- } else {
+ } else {
neg = 0;
if (c == '+')
c = *s++;
@@ -87,6 +87,8 @@ strtouq(nptr, endptr, base)
cutoff = (u_quad_t)UQUAD_MAX / qbase;
cutlim = (u_quad_t)UQUAD_MAX % qbase;
for (acc = 0, any = 0;; c = *s++) {
+ if (!isascii(c))
+ break;
if (isdigit(c))
c -= '0';
else if (isalpha(c))
OpenPOWER on IntegriCloud