diff options
author | deraadt <> | 2013-11-24 23:51:28 +0000 |
---|---|---|
committer | deraadt <> | 2013-11-24 23:51:28 +0000 |
commit | f11a3ee4ffc0c81cd1b27af469d8dad6d48fbf49 (patch) | |
tree | 8b0dc0aec4e68a473b18cd53d3ee9d18e013a13d /src/lib/libc/net/inet_addr.c | |
parent | eb56a6b4b449d7d65f54812c03a2562929966616 (diff) | |
download | openbsd-f11a3ee4ffc0c81cd1b27af469d8dad6d48fbf49.tar.gz openbsd-f11a3ee4ffc0c81cd1b27af469d8dad6d48fbf49.tar.bz2 openbsd-f11a3ee4ffc0c81cd1b27af469d8dad6d48fbf49.zip |
most obvious unsigned char casts for ctype
ok jca krw ingo
Diffstat (limited to 'src/lib/libc/net/inet_addr.c')
-rw-r--r-- | src/lib/libc/net/inet_addr.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/lib/libc/net/inet_addr.c b/src/lib/libc/net/inet_addr.c index c962a03382..18762ab522 100644 --- a/src/lib/libc/net/inet_addr.c +++ b/src/lib/libc/net/inet_addr.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: inet_addr.c,v 1.9 2005/08/06 20:30:03 espie Exp $ */ | 1 | /* $OpenBSD: inet_addr.c,v 1.10 2013/11/24 23:51:28 deraadt Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * ++Copyright++ 1983, 1990, 1993 | 4 | * ++Copyright++ 1983, 1990, 1993 |
@@ -94,7 +94,7 @@ inet_aton(const char *cp, struct in_addr *addr) | |||
94 | * Values are specified as for C: | 94 | * Values are specified as for C: |
95 | * 0x=hex, 0=octal, isdigit=decimal. | 95 | * 0x=hex, 0=octal, isdigit=decimal. |
96 | */ | 96 | */ |
97 | if (!isdigit(c)) | 97 | if (!isdigit((unsigned char)c)) |
98 | return (0); | 98 | return (0); |
99 | val = 0; base = 10; | 99 | val = 0; base = 10; |
100 | if (c == '0') { | 100 | if (c == '0') { |
@@ -105,12 +105,15 @@ inet_aton(const char *cp, struct in_addr *addr) | |||
105 | base = 8; | 105 | base = 8; |
106 | } | 106 | } |
107 | for (;;) { | 107 | for (;;) { |
108 | if (isascii(c) && isdigit(c)) { | 108 | if (isascii((unsigned char)c) && |
109 | isdigit((unsigned char)c)) { | ||
109 | val = (val * base) + (c - '0'); | 110 | val = (val * base) + (c - '0'); |
110 | c = *++cp; | 111 | c = *++cp; |
111 | } else if (base == 16 && isascii(c) && isxdigit(c)) { | 112 | } else if (base == 16 && |
113 | isascii((unsigned char)c) && | ||
114 | isxdigit((unsigned char)c)) { | ||
112 | val = (val << 4) | | 115 | val = (val << 4) | |
113 | (c + 10 - (islower(c) ? 'a' : 'A')); | 116 | (c + 10 - (islower((unsigned char)c) ? 'a' : 'A')); |
114 | c = *++cp; | 117 | c = *++cp; |
115 | } else | 118 | } else |
116 | break; | 119 | break; |
@@ -132,7 +135,8 @@ inet_aton(const char *cp, struct in_addr *addr) | |||
132 | /* | 135 | /* |
133 | * Check for trailing characters. | 136 | * Check for trailing characters. |
134 | */ | 137 | */ |
135 | if (c != '\0' && (!isascii(c) || !isspace(c))) | 138 | if (c != '\0' && |
139 | (!isascii((unsigned char)c) || !isspace((unsigned char)c))) | ||
136 | return (0); | 140 | return (0); |
137 | /* | 141 | /* |
138 | * Concoct the address according to | 142 | * Concoct the address according to |