summaryrefslogtreecommitdiff
path: root/lib/libc/stdlib/strtol.c
diff options
context:
space:
mode:
authorAndrey A. Chernov <ache@FreeBSD.org>2005-01-21 00:42:13 +0000
committerAndrey A. Chernov <ache@FreeBSD.org>2005-01-21 00:42:13 +0000
commit2571c7f7200f06b1055c8360f17a9a0f4eca06f4 (patch)
treed24a817d276208fdac47a21499eab3278d2f86ba /lib/libc/stdlib/strtol.c
parentf3f82767324f6ebd66e0bfc06f419553b022e564 (diff)
Notes
Diffstat (limited to 'lib/libc/stdlib/strtol.c')
-rw-r--r--lib/libc/stdlib/strtol.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/libc/stdlib/strtol.c b/lib/libc/stdlib/strtol.c
index 658628e370c60..5aae7f9dc0bc4 100644
--- a/lib/libc/stdlib/strtol.c
+++ b/lib/libc/stdlib/strtol.c
@@ -76,7 +76,11 @@ strtol(const char * __restrict nptr, char ** __restrict endptr, int base)
c = *s++;
}
if ((base == 0 || base == 16) &&
- c == '0' && (*s == 'x' || *s == 'X')) {
+ c == '0' && (*s == 'x' || *s == 'X') &&
+ ((s[1] >= 'a' && s[1] <= 'f') ||
+ (s[1] >= 'A' && s[1] <= 'F') ||
+ (s[1] >= '0' && s[1] <= '9'))
+ ) {
c = s[1];
s += 2;
base = 16;