diff options
Diffstat (limited to 'src/lib/libc/stdlib/strtoull.c')
-rw-r--r-- | src/lib/libc/stdlib/strtoull.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/lib/libc/stdlib/strtoull.c b/src/lib/libc/stdlib/strtoull.c index 28f613a087..846417630f 100644 --- a/src/lib/libc/stdlib/strtoull.c +++ b/src/lib/libc/stdlib/strtoull.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* $OpenBSD: strtoull.c,v 1.6 2013/03/28 18:09:38 martynas Exp $ */ | 1 | /* $OpenBSD: strtoull.c,v 1.7 2014/09/13 20:10:12 schwarze Exp $ */ |
2 | /*- | 2 | /* |
3 | * Copyright (c) 1992 The Regents of the University of California. | 3 | * Copyright (c) 1992 The Regents of the University of California. |
4 | * All rights reserved. | 4 | * All rights reserved. |
5 | * | 5 | * |
@@ -50,8 +50,15 @@ strtoull(const char *nptr, char **endptr, int base) | |||
50 | int neg, any, cutlim; | 50 | int neg, any, cutlim; |
51 | 51 | ||
52 | /* | 52 | /* |
53 | * See strtoq for comments as to the logic used. | 53 | * See strtoll for comments as to the logic used. |
54 | */ | 54 | */ |
55 | if (base < 0 || base == 1 || base > 36) { | ||
56 | if (endptr != 0) | ||
57 | *endptr = (char *)nptr; | ||
58 | errno = EINVAL; | ||
59 | return 0; | ||
60 | } | ||
61 | |||
55 | s = nptr; | 62 | s = nptr; |
56 | do { | 63 | do { |
57 | c = (unsigned char) *s++; | 64 | c = (unsigned char) *s++; |
@@ -59,7 +66,7 @@ strtoull(const char *nptr, char **endptr, int base) | |||
59 | if (c == '-') { | 66 | if (c == '-') { |
60 | neg = 1; | 67 | neg = 1; |
61 | c = *s++; | 68 | c = *s++; |
62 | } else { | 69 | } else { |
63 | neg = 0; | 70 | neg = 0; |
64 | if (c == '+') | 71 | if (c == '+') |
65 | c = *s++; | 72 | c = *s++; |