X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Finternal%2Fintscan.c;h=a4a5ae861282863035a492ce8db0e18d4acfe3ac;hb=bf14ef193b4203aa9a8b173faeeea06d98397f65;hp=d65fc45c3c5359a7ffc88066b13cfeaf805a02fb;hpb=bb477f9fd4a69bac77c70d2099272ee1ac17e62c;p=musl diff --git a/src/internal/intscan.c b/src/internal/intscan.c index d65fc45c..a4a5ae86 100644 --- a/src/internal/intscan.c +++ b/src/internal/intscan.c @@ -1,5 +1,6 @@ #include #include +#include #include "shgetc.h" /* Lookup table for digit values. -1==255>=36 -> invalid */ @@ -28,11 +29,11 @@ unsigned long long __intscan(FILE *f, unsigned base, int pok, unsigned long long int c, neg=0; unsigned x; unsigned long long y; - if (base > 36) { + if (base > 36 || base == 1) { errno = EINVAL; return 0; } - c = shgetc(f); + while (isspace((c=shgetc(f)))); if (c=='+' || c=='-') { neg = -(c=='-'); c = shgetc(f); @@ -82,6 +83,7 @@ unsigned long long __intscan(FILE *f, unsigned base, int pok, unsigned long long for (; val[c]