提交 809ff8cf 编写于 作者: R Rich Felker

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.
上级 786fda87
...@@ -29,7 +29,7 @@ unsigned long long __intscan(FILE *f, unsigned base, int pok, unsigned long long ...@@ -29,7 +29,7 @@ unsigned long long __intscan(FILE *f, unsigned base, int pok, unsigned long long
int c, neg=0; int c, neg=0;
unsigned x; unsigned x;
unsigned long long y; unsigned long long y;
if (base > 36) { if (base > 36 || base == 1) {
errno = EINVAL; errno = EINVAL;
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册