diff options
Diffstat (limited to 'src/lib/libc/stdlib/strtoumax.c')
-rw-r--r-- | src/lib/libc/stdlib/strtoumax.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/lib/libc/stdlib/strtoumax.c b/src/lib/libc/stdlib/strtoumax.c index ce6e2c00f1..c73f7e507c 100644 --- a/src/lib/libc/stdlib/strtoumax.c +++ b/src/lib/libc/stdlib/strtoumax.c | |||
@@ -1,6 +1,5 @@ | |||
1 | /* $OpenBSD: strtoumax.c,v 1.1 2006/01/13 17:58:09 millert Exp $ */ | 1 | /* $OpenBSD: strtoumax.c,v 1.2 2014/09/13 20:10:12 schwarze Exp $ */ |
2 | 2 | /* | |
3 | /*- | ||
4 | * Copyright (c) 1992 The Regents of the University of California. | 3 | * Copyright (c) 1992 The Regents of the University of California. |
5 | * All rights reserved. | 4 | * All rights reserved. |
6 | * | 5 | * |
@@ -48,8 +47,15 @@ strtoumax(const char *nptr, char **endptr, int base) | |||
48 | int neg, any, cutlim; | 47 | int neg, any, cutlim; |
49 | 48 | ||
50 | /* | 49 | /* |
51 | * See strtoq for comments as to the logic used. | 50 | * See strtoimax for comments as to the logic used. |
52 | */ | 51 | */ |
52 | if (base < 0 || base == 1 || base > 36) { | ||
53 | if (endptr != 0) | ||
54 | *endptr = (char *)nptr; | ||
55 | errno = EINVAL; | ||
56 | return 0; | ||
57 | } | ||
58 | |||
53 | s = nptr; | 59 | s = nptr; |
54 | do { | 60 | do { |
55 | c = (unsigned char) *s++; | 61 | c = (unsigned char) *s++; |
@@ -57,7 +63,7 @@ strtoumax(const char *nptr, char **endptr, int base) | |||
57 | if (c == '-') { | 63 | if (c == '-') { |
58 | neg = 1; | 64 | neg = 1; |
59 | c = *s++; | 65 | c = *s++; |
60 | } else { | 66 | } else { |
61 | neg = 0; | 67 | neg = 0; |
62 | if (c == '+') | 68 | if (c == '+') |
63 | c = *s++; | 69 | c = *s++; |