summaryrefslogtreecommitdiff
path: root/lib/libc/stdlib/strtoul.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1996-07-27 10:45:27 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1996-07-27 10:45:27 +0000
commit5bea288f6608e242c7d157ce28a6859bb37d6e20 (patch)
tree244c7c4c0538b71133b44fce185b1853b28d0834 /lib/libc/stdlib/strtoul.c
parent5507d8e1c590b85bc9d7a51585295d6a2284f9fd (diff)
be very careful in case of signed chars
Diffstat (limited to 'lib/libc/stdlib/strtoul.c')
-rw-r--r--lib/libc/stdlib/strtoul.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libc/stdlib/strtoul.c b/lib/libc/stdlib/strtoul.c
index 1522bec5845..9d45c5cb9e6 100644
--- a/lib/libc/stdlib/strtoul.c
+++ b/lib/libc/stdlib/strtoul.c
@@ -33,7 +33,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
/*static char *sccsid = "from: @(#)strtoul.c 5.3 (Berkeley) 2/23/91";*/
-static char *rcsid = "$Id: strtoul.c,v 1.2 1995/12/21 14:58:38 deraadt Exp $";
+static char *rcsid = "$Id: strtoul.c,v 1.3 1996/07/27 10:45:25 deraadt Exp $";
#endif /* LIBC_SCCS and not lint */
#include <ctype.h>
@@ -63,7 +63,7 @@ strtoul(nptr, endptr, base)
*/
s = nptr;
do {
- c = *s++;
+ c = (unsigned char) *s++;
} while (isspace(c));
if (c == '-') {
neg = 1;
@@ -84,7 +84,7 @@ strtoul(nptr, endptr, base)
cutoff = ULONG_MAX / (unsigned long)base;
cutlim = ULONG_MAX % (unsigned long)base;
- for (acc = 0, any = 0;; c = *s++) {
+ for (acc = 0, any = 0;; c = (unsigned char) *s++) {
if (isdigit(c))
c -= '0';
else if (isalpha(c))