diff options
author | Rich Felker <dalias@aerifal.cx> | 2014-09-16 16:08:53 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2015-03-30 01:15:44 -0400 |
commit | 0a7aca63c0fe68449086074e32dd55bfcb9efdc2 (patch) | |
tree | 8ebf9e652ceba125640bcb3d253cafe926a33a96 /src | |
parent | 1d19a53b8c88de336ee30d818b5d2d9e077091e9 (diff) | |
download | musl-0a7aca63c0fe68449086074e32dd55bfcb9efdc2.tar.gz musl-0a7aca63c0fe68449086074e32dd55bfcb9efdc2.tar.xz musl-0a7aca63c0fe68449086074e32dd55bfcb9efdc2.zip |
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. (cherry picked from commit e2e1bb81485a37321d928a8d8b63f40b9d8fa228)
Diffstat (limited to 'src')
-rw-r--r-- | src/internal/intscan.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/internal/intscan.c b/src/internal/intscan.c index 69350efa..65d497ec 100644 --- a/src/internal/intscan.c +++ b/src/internal/intscan.c @@ -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); |