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.
int c, neg=0;
unsigned x;
unsigned long long y;
- if (base > 36) {
+ if (base > 36 || base == 1) {
errno = EINVAL;
return 0;
}