summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>2001-11-28 06:06:27 +0000
committerache <ache@FreeBSD.org>2001-11-28 06:06:27 +0000
commit3a5ef923430736453c2e3800277c2558c14e0f25 (patch)
tree7fda1da266f5c4d254c366b8856290fa9ad01569 /lib
parentf320d6c29a634f799998ac539ecc1fc1f261e4c5 (diff)
downloadFreeBSD-src-3a5ef923430736453c2e3800277c2558c14e0f25.zip
FreeBSD-src-3a5ef923430736453c2e3800277c2558c14e0f25.tar.gz
Don't ever assume that isdigit() is always subset of isxdigit()
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/stdio/vfscanf.c2
-rw-r--r--lib/libc/stdlib/strtoimax.c2
-rw-r--r--lib/libc/stdlib/strtol.c2
-rw-r--r--lib/libc/stdlib/strtoll.c2
-rw-r--r--lib/libc/stdlib/strtoul.c2
-rw-r--r--lib/libc/stdlib/strtoull.c2
-rw-r--r--lib/libc/stdlib/strtoumax.c2
7 files changed, 7 insertions, 7 deletions
diff --git a/lib/libc/stdio/vfscanf.c b/lib/libc/stdio/vfscanf.c
index 3925aa5..6072112 100644
--- a/lib/libc/stdio/vfscanf.c
+++ b/lib/libc/stdio/vfscanf.c
@@ -488,7 +488,7 @@ literal:
break;
default:
- if (!isxdigit(c))
+ if (!isdigit(c) && (base != 16 || !isxdigit(c)))
break;
n = digittoint(c);
if (n >= 16)
diff --git a/lib/libc/stdlib/strtoimax.c b/lib/libc/stdlib/strtoimax.c
index f8ff09b..e5e0442 100644
--- a/lib/libc/stdlib/strtoimax.c
+++ b/lib/libc/stdlib/strtoimax.c
@@ -112,7 +112,7 @@ strtoimax(nptr, endptr, base)
cutlim = cutoff % base;
cutoff /= base;
for ( ; ; c = *s++) {
- if (isxdigit(c))
+ if (isdigit(c) || (base == 16 && isxdigit(c)))
c = digittoint(c);
else if (isascii(c) && isalpha(c))
c -= isupper(c) ? 'A' - 10 : 'a' - 10;
diff --git a/lib/libc/stdlib/strtol.c b/lib/libc/stdlib/strtol.c
index 3d19693..9ff4ec4 100644
--- a/lib/libc/stdlib/strtol.c
+++ b/lib/libc/stdlib/strtol.c
@@ -112,7 +112,7 @@ strtol(nptr, endptr, base)
cutlim = cutoff % base;
cutoff /= base;
for ( ; ; c = *s++) {
- if (isxdigit(c))
+ if (isdigit(c) || (base == 16 && isxdigit(c)))
c = digittoint(c);
else if (isascii(c) && isalpha(c))
c -= isupper(c) ? 'A' - 10 : 'a' - 10;
diff --git a/lib/libc/stdlib/strtoll.c b/lib/libc/stdlib/strtoll.c
index 1fd7d9c..c4fcfef 100644
--- a/lib/libc/stdlib/strtoll.c
+++ b/lib/libc/stdlib/strtoll.c
@@ -112,7 +112,7 @@ strtoll(nptr, endptr, base)
cutlim = cutoff % base;
cutoff /= base;
for ( ; ; c = *s++) {
- if (isxdigit(c))
+ if (isdigit(c) || (base == 16 && isxdigit(c)))
c = digittoint(c);
else if (isascii(c) && isalpha(c))
c -= isupper(c) ? 'A' - 10 : 'a' - 10;
diff --git a/lib/libc/stdlib/strtoul.c b/lib/libc/stdlib/strtoul.c
index e431dc8..4d08b2c 100644
--- a/lib/libc/stdlib/strtoul.c
+++ b/lib/libc/stdlib/strtoul.c
@@ -90,7 +90,7 @@ strtoul(nptr, endptr, base)
cutoff = ULONG_MAX / base;
cutlim = ULONG_MAX % base;
for ( ; ; c = *s++) {
- if (isxdigit(c))
+ if (isdigit(c) || (base == 16 && isxdigit(c)))
c = digittoint(c);
else if (isascii(c) && isalpha(c))
c -= isupper(c) ? 'A' - 10 : 'a' - 10;
diff --git a/lib/libc/stdlib/strtoull.c b/lib/libc/stdlib/strtoull.c
index adb6556..34678fe 100644
--- a/lib/libc/stdlib/strtoull.c
+++ b/lib/libc/stdlib/strtoull.c
@@ -90,7 +90,7 @@ strtoull(nptr, endptr, base)
cutoff = ULLONG_MAX / base;
cutlim = ULLONG_MAX % base;
for ( ; ; c = *s++) {
- if (isxdigit(c))
+ if (isdigit(c) || (base == 16 && isxdigit(c)))
c = digittoint(c);
else if (isascii(c) && isalpha(c))
c -= isupper(c) ? 'A' - 10 : 'a' - 10;
diff --git a/lib/libc/stdlib/strtoumax.c b/lib/libc/stdlib/strtoumax.c
index ea59245..bdcfbd7 100644
--- a/lib/libc/stdlib/strtoumax.c
+++ b/lib/libc/stdlib/strtoumax.c
@@ -90,7 +90,7 @@ strtoumax(nptr, endptr, base)
cutoff = UINTMAX_MAX / base;
cutlim = UINTMAX_MAX % base;
for ( ; ; c = *s++) {
- if (isxdigit(c))
+ if (isdigit(c) || (base == 16 && isxdigit(c)))
c = digittoint(c);
else if (isascii(c) && isalpha(c))
c -= isupper(c) ? 'A' - 10 : 'a' - 10;
OpenPOWER on IntegriCloud