From 0548e292bd978f210f0f235daf02b3ab3d37c85c Mon Sep 17 00:00:00 2001 From: ache Date: Tue, 1 Aug 1995 22:04:57 +0000 Subject: Similar changes like in strtol, all this family is VERY broken in 8bit environment (isalpha at the end of digits) --- lib/libc/stdlib/strtoul.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/libc/stdlib/strtoul.c') diff --git a/lib/libc/stdlib/strtoul.c b/lib/libc/stdlib/strtoul.c index e60556c0..0bf6b82 100644 --- a/lib/libc/stdlib/strtoul.c +++ b/lib/libc/stdlib/strtoul.c @@ -54,7 +54,7 @@ strtoul(nptr, endptr, base) { register const char *s = nptr; register unsigned long acc; - register int c; + register unsigned char c; register unsigned long cutoff; register int neg = 0, any, cutlim; @@ -80,6 +80,8 @@ strtoul(nptr, endptr, base) cutoff = (unsigned long)ULONG_MAX / (unsigned long)base; cutlim = (unsigned long)ULONG_MAX % (unsigned long)base; for (acc = 0, any = 0;; c = *s++) { + if (!isascii(c)) + break; if (isdigit(c)) c -= '0'; else if (isalpha(c)) -- cgit v1.1