mirror of
git://git.musl-libc.org/musl
synced 2024-12-17 12:14:42 +00:00
fix overflow corner case in strtoul-family functions
incorrect behavior occurred only in cases where the input overflows unsigned long long, not just the (possibly lower) range limit for the result type. in this case, processing of the '-' sign character was not suppressed, and the function returned a value of 1 despite setting errno to ERANGE.
This commit is contained in:
parent
ec1aed0a14
commit
e2e1bb8148
@ -83,6 +83,7 @@ unsigned long long __intscan(FILE *f, unsigned base, int pok, unsigned long long
|
||||
for (; val[c]<base; c=shgetc(f));
|
||||
errno = ERANGE;
|
||||
y = lim;
|
||||
if (lim&1) neg = 0;
|
||||
}
|
||||
done:
|
||||
shunget(f);
|
||||
|
Loading…
Reference in New Issue
Block a user