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 | |
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
-rw-r--r-- | src/lib/libc/net/base64.c | 14 | ||||
-rw-r--r-- | src/lib/libc/net/ethers.c | 10 | ||||
-rw-r--r-- | src/lib/libc/net/inet_addr.c | 16 | ||||
-rw-r--r-- | src/lib/libc/net/ruserok.c | 7 |
4 files changed, 27 insertions, 20 deletions
diff --git a/src/lib/libc/net/base64.c b/src/lib/libc/net/base64.c index d432c48d5c..78ef449a75 100644 --- a/src/lib/libc/net/base64.c +++ b/src/lib/libc/net/base64.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: base64.c,v 1.5 2006/10/21 09:55:03 otto Exp $ */ | 1 | /* $OpenBSD: base64.c,v 1.6 2013/11/24 23:51:28 deraadt Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 1996 by Internet Software Consortium. | 4 | * Copyright (c) 1996 by Internet Software Consortium. |
@@ -199,7 +199,7 @@ b64_pton(src, target, targsize) | |||
199 | state = 0; | 199 | state = 0; |
200 | tarindex = 0; | 200 | tarindex = 0; |
201 | 201 | ||
202 | while ((ch = *src++) != '\0') { | 202 | while ((ch = (unsigned char)*src++) != '\0') { |
203 | if (isspace(ch)) /* Skip whitespace anywhere. */ | 203 | if (isspace(ch)) /* Skip whitespace anywhere. */ |
204 | continue; | 204 | continue; |
205 | 205 | ||
@@ -258,8 +258,8 @@ b64_pton(src, target, targsize) | |||
258 | * on a byte boundary, and/or with erroneous trailing characters. | 258 | * on a byte boundary, and/or with erroneous trailing characters. |
259 | */ | 259 | */ |
260 | 260 | ||
261 | if (ch == Pad64) { /* We got a pad char. */ | 261 | if (ch == Pad64) { /* We got a pad char. */ |
262 | ch = *src++; /* Skip it, get next. */ | 262 | ch = (unsigned char)*src++; /* Skip it, get next. */ |
263 | switch (state) { | 263 | switch (state) { |
264 | case 0: /* Invalid = in first position */ | 264 | case 0: /* Invalid = in first position */ |
265 | case 1: /* Invalid = in second position */ | 265 | case 1: /* Invalid = in second position */ |
@@ -267,13 +267,13 @@ b64_pton(src, target, targsize) | |||
267 | 267 | ||
268 | case 2: /* Valid, means one byte of info */ | 268 | case 2: /* Valid, means one byte of info */ |
269 | /* Skip any number of spaces. */ | 269 | /* Skip any number of spaces. */ |
270 | for (; ch != '\0'; ch = *src++) | 270 | for (; ch != '\0'; ch = (unsigned char)*src++) |
271 | if (!isspace(ch)) | 271 | if (!isspace(ch)) |
272 | break; | 272 | break; |
273 | /* Make sure there is another trailing = sign. */ | 273 | /* Make sure there is another trailing = sign. */ |
274 | if (ch != Pad64) | 274 | if (ch != Pad64) |
275 | return (-1); | 275 | return (-1); |
276 | ch = *src++; /* Skip the = */ | 276 | ch = (unsigned char)*src++; /* Skip the = */ |
277 | /* Fall through to "single trailing =" case. */ | 277 | /* Fall through to "single trailing =" case. */ |
278 | /* FALLTHROUGH */ | 278 | /* FALLTHROUGH */ |
279 | 279 | ||
@@ -282,7 +282,7 @@ b64_pton(src, target, targsize) | |||
282 | * We know this char is an =. Is there anything but | 282 | * We know this char is an =. Is there anything but |
283 | * whitespace after it? | 283 | * whitespace after it? |
284 | */ | 284 | */ |
285 | for (; ch != '\0'; ch = *src++) | 285 | for (; ch != '\0'; ch = (unsigned char)*src++) |
286 | if (!isspace(ch)) | 286 | if (!isspace(ch)) |
287 | return (-1); | 287 | return (-1); |
288 | 288 | ||
diff --git a/src/lib/libc/net/ethers.c b/src/lib/libc/net/ethers.c index d4243ff1da..af31bb8e60 100644 --- a/src/lib/libc/net/ethers.c +++ b/src/lib/libc/net/ethers.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ethers.c,v 1.20 2005/08/06 20:30:03 espie Exp $ */ | 1 | /* $OpenBSD: ethers.c,v 1.21 2013/11/24 23:51:28 deraadt Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com> | 4 | * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com> |
@@ -64,7 +64,7 @@ _ether_aton(const char *s, struct ether_addr *e) | |||
64 | long l; | 64 | long l; |
65 | char *pp; | 65 | char *pp; |
66 | 66 | ||
67 | while (isspace(*s)) | 67 | while (isspace((unsigned char)*s)) |
68 | s++; | 68 | s++; |
69 | 69 | ||
70 | /* expect 6 hex octets separated by ':' or space/NUL if last octet */ | 70 | /* expect 6 hex octets separated by ':' or space/NUL if last octet */ |
@@ -72,7 +72,9 @@ _ether_aton(const char *s, struct ether_addr *e) | |||
72 | l = strtol(s, &pp, 16); | 72 | l = strtol(s, &pp, 16); |
73 | if (pp == s || l > 0xFF || l < 0) | 73 | if (pp == s || l > 0xFF || l < 0) |
74 | return (NULL); | 74 | return (NULL); |
75 | if (!(*pp == ':' || (i == 5 && (isspace(*pp) || *pp == '\0')))) | 75 | if (!(*pp == ':' || |
76 | (i == 5 && (isspace((unsigned char)*pp) || | ||
77 | *pp == '\0')))) | ||
76 | return (NULL); | 78 | return (NULL); |
77 | e->ether_addr_octet[i] = (u_char)l; | 79 | e->ether_addr_octet[i] = (u_char)l; |
78 | s = pp + 1; | 80 | s = pp + 1; |
@@ -216,7 +218,7 @@ ether_line(const char *line, struct ether_addr *e, char *hostname) | |||
216 | goto bad; | 218 | goto bad; |
217 | 219 | ||
218 | /* Now get the hostname */ | 220 | /* Now get the hostname */ |
219 | while (isspace(*p)) | 221 | while (isspace((unsigned char)*p)) |
220 | p++; | 222 | p++; |
221 | if (*p == '\0') | 223 | if (*p == '\0') |
222 | goto bad; | 224 | goto bad; |
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 |
diff --git a/src/lib/libc/net/ruserok.c b/src/lib/libc/net/ruserok.c index 46fba4beb2..21646c156b 100644 --- a/src/lib/libc/net/ruserok.c +++ b/src/lib/libc/net/ruserok.c | |||
@@ -214,9 +214,10 @@ __ivaliduser_sa(FILE *hostf, struct sockaddr *raddr, socklen_t salen, | |||
214 | if (*p == '#') | 214 | if (*p == '#') |
215 | continue; | 215 | continue; |
216 | while (p < buf + buflen && *p != '\n' && *p != ' ' && *p != '\t') { | 216 | while (p < buf + buflen && *p != '\n' && *p != ' ' && *p != '\t') { |
217 | if (!isprint(*p)) | 217 | if (!isprint((unsigned char)*p)) |
218 | goto bail; | 218 | goto bail; |
219 | *p = isupper(*p) ? tolower(*p) : *p; | 219 | *p = isupper((unsigned char)*p) ? |
220 | tolower((unsigned char)*p) : *p; | ||
220 | p++; | 221 | p++; |
221 | } | 222 | } |
222 | if (p >= buf + buflen) | 223 | if (p >= buf + buflen) |
@@ -230,7 +231,7 @@ __ivaliduser_sa(FILE *hostf, struct sockaddr *raddr, socklen_t salen, | |||
230 | user = p; | 231 | user = p; |
231 | while (p < buf + buflen && *p != '\n' && *p != ' ' && | 232 | while (p < buf + buflen && *p != '\n' && *p != ' ' && |
232 | *p != '\t') { | 233 | *p != '\t') { |
233 | if (!isprint(*p)) | 234 | if (!isprint((unsigned char)*p)) |
234 | goto bail; | 235 | goto bail; |
235 | p++; | 236 | p++; |
236 | } | 237 | } |