diff options
Diffstat (limited to 'lib/libc/stdlib/strtoull.c')
| -rw-r--r-- | lib/libc/stdlib/strtoull.c | 14 | 
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/libc/stdlib/strtoull.c b/lib/libc/stdlib/strtoull.c index adb655681da9..d9e3e4fd8cfb 100644 --- a/lib/libc/stdlib/strtoull.c +++ b/lib/libc/stdlib/strtoull.c @@ -58,7 +58,7 @@ strtoull(nptr, endptr, base)  	unsigned long long acc;  	unsigned char c;  	unsigned long long cutoff; -	int neg, any, cutlim; +	int neg, any, cutlim, n;  	/*  	 * See strtoq for comments as to the logic used. @@ -91,19 +91,19 @@ strtoull(nptr, endptr, base)  	cutlim = ULLONG_MAX % base;  	for ( ; ; c = *s++) {  		if (isxdigit(c)) -			c = digittoint(c); -		else if (isascii(c) && isalpha(c)) -			c -= isupper(c) ? 'A' - 10 : 'a' - 10; +			n = digittoint(c); +		else if (isalpha(c)) +			n = (char)c - (isupper(c) ? 'A' - 10 : 'a' - 10);  		else  			break; -		if (c >= base) +		if (n < 0 || n >= base)  			break; -		if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim)) +		if (any < 0 || acc > cutoff || (acc == cutoff && n > cutlim))  			any = -1;  		else {  			any = 1;  			acc *= base; -			acc += c; +			acc += n;  		}  	}  	if (any < 0) {  | 
