diff options
Diffstat (limited to 'src/lib/libc/stdlib')
| -rw-r--r-- | src/lib/libc/stdlib/strtol.c | 8 | ||||
| -rw-r--r-- | src/lib/libc/stdlib/strtoul.c | 4 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/lib/libc/stdlib/strtol.c b/src/lib/libc/stdlib/strtol.c index 745bc4c2ce..dc2cf8871c 100644 --- a/src/lib/libc/stdlib/strtol.c +++ b/src/lib/libc/stdlib/strtol.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: strtol.c,v 1.8 2012/11/18 04:13:39 jsing Exp $ */ | 1 | /* $OpenBSD: strtol.c,v 1.9 2013/04/17 17:40:35 tedu Exp $ */ |
| 2 | /*- | 2 | /*- |
| 3 | * Copyright (c) 1990 The Regents of the University of California. | 3 | * Copyright (c) 1990 The Regents of the University of California. |
| 4 | * All rights reserved. | 4 | * All rights reserved. |
| @@ -54,7 +54,7 @@ strtol(const char *nptr, char **endptr, int base) | |||
| 54 | */ | 54 | */ |
| 55 | if (base != 0 && (base < 2 || base > 36)) { | 55 | if (base != 0 && (base < 2 || base > 36)) { |
| 56 | if (endptr != 0) | 56 | if (endptr != 0) |
| 57 | *endptr = nptr; | 57 | *endptr = (char *)nptr; |
| 58 | errno = EINVAL; | 58 | errno = EINVAL; |
| 59 | return 0; | 59 | return 0; |
| 60 | } | 60 | } |
| @@ -124,7 +124,7 @@ strtol(const char *nptr, char **endptr, int base) | |||
| 124 | if (any < 0) | 124 | if (any < 0) |
| 125 | continue; | 125 | continue; |
| 126 | if (neg) { | 126 | if (neg) { |
| 127 | if (acc < cutoff || acc == cutoff && c > cutlim) { | 127 | if (acc < cutoff || (acc == cutoff && c > cutlim)) { |
| 128 | any = -1; | 128 | any = -1; |
| 129 | acc = LONG_MIN; | 129 | acc = LONG_MIN; |
| 130 | errno = ERANGE; | 130 | errno = ERANGE; |
| @@ -134,7 +134,7 @@ strtol(const char *nptr, char **endptr, int base) | |||
| 134 | acc -= c; | 134 | acc -= c; |
| 135 | } | 135 | } |
| 136 | } else { | 136 | } else { |
| 137 | if (acc > cutoff || acc == cutoff && c > cutlim) { | 137 | if (acc > cutoff || (acc == cutoff && c > cutlim)) { |
| 138 | any = -1; | 138 | any = -1; |
| 139 | acc = LONG_MAX; | 139 | acc = LONG_MAX; |
| 140 | errno = ERANGE; | 140 | errno = ERANGE; |
diff --git a/src/lib/libc/stdlib/strtoul.c b/src/lib/libc/stdlib/strtoul.c index d7dddab778..a236365d2f 100644 --- a/src/lib/libc/stdlib/strtoul.c +++ b/src/lib/libc/stdlib/strtoul.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: strtoul.c,v 1.7 2005/08/08 08:05:37 espie Exp $ */ | 1 | /* $OpenBSD: strtoul.c,v 1.8 2013/04/17 17:40:35 tedu Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 1990 Regents of the University of California. | 3 | * Copyright (c) 1990 Regents of the University of California. |
| 4 | * All rights reserved. | 4 | * All rights reserved. |
| @@ -84,7 +84,7 @@ strtoul(const char *nptr, char **endptr, int base) | |||
| 84 | break; | 84 | break; |
| 85 | if (any < 0) | 85 | if (any < 0) |
| 86 | continue; | 86 | continue; |
| 87 | if (acc > cutoff || acc == cutoff && c > cutlim) { | 87 | if (acc > cutoff || (acc == cutoff && c > cutlim)) { |
| 88 | any = -1; | 88 | any = -1; |
| 89 | acc = ULONG_MAX; | 89 | acc = ULONG_MAX; |
| 90 | errno = ERANGE; | 90 | errno = ERANGE; |
