summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2017-01-04 19:48:21 -0500
committerRich Felker <dalias@aerifal.cx>2017-01-04 19:52:24 -0500
commit809ff8cf90254921ea38eb6fa1ce326d9008513b (patch)
tree2e33edaa7f9466a8b43fb16833789ea1e283d9b7
parent786fda875a901dc1807289c940338487854cd3ba (diff)
downloadmusl-809ff8cf90254921ea38eb6fa1ce326d9008513b.tar.gz
treat base 1 as an error in strtol-family functions
ISO C and POSIX only specify behavior for base arguments of 0 and 2-36; POSIX mandates an EINVAL error for unsupported bases. it's not clear that there's a requirement for implementations not to "support" additional bases as an extension, but "base 1" did not work in any meaningful way anyway, so it should be considered unsupported and thus an error.
-rw-r--r--src/internal/intscan.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/internal/intscan.c b/src/internal/intscan.c
index 65d497ec..a4a5ae86 100644
--- a/src/internal/intscan.c
+++ b/src/internal/intscan.c
@@ -29,7 +29,7 @@ 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;
}