diff options
author | Reyk Floeter <reyk@cvs.openbsd.org> | 2015-10-13 07:57:14 +0000 |
---|---|---|
committer | Reyk Floeter <reyk@cvs.openbsd.org> | 2015-10-13 07:57:14 +0000 |
commit | bdabc7146b259cb3e4ff70e44c8490908a2d76ed (patch) | |
tree | 923919f6ad40cdd5b2b395188aa6c0942306a310 | |
parent | 99f8689db981652cb7bd6f1930db2a5c56a3cd17 (diff) |
Pass unsigned chars to ctype functions.
From Michael McConville
-rw-r--r-- | usr.sbin/httpd/httpd.c | 7 | ||||
-rw-r--r-- | usr.sbin/httpd/server_http.c | 4 |
2 files changed, 6 insertions, 5 deletions
diff --git a/usr.sbin/httpd/httpd.c b/usr.sbin/httpd/httpd.c index f6deceaaa72..e3e095ccbc6 100644 --- a/usr.sbin/httpd/httpd.c +++ b/usr.sbin/httpd/httpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: httpd.c,v 1.39 2015/08/20 13:00:23 reyk Exp $ */ +/* $OpenBSD: httpd.c,v 1.40 2015/10/13 07:57:13 reyk Exp $ */ /* * Copyright (c) 2014 Reyk Floeter <reyk@openbsd.org> @@ -565,7 +565,7 @@ canonicalize_host(const char *host, char *name, size_t len) for (i = j = 0; i < plen; i++) { if (j >= (len - 1)) goto fail; - c = tolower(host[i]); + c = tolower((unsigned char)host[i]); if ((c == '.') && (j == 0 || name[j - 1] == '.')) continue; name[j++] = c; @@ -602,7 +602,8 @@ url_decode(char *url) switch (*p) { case '%': /* Encoding character is followed by two hex chars */ - if (!(isxdigit(p[1]) && isxdigit(p[2]))) + if (!(isxdigit((unsigned char)p[1]) && + isxdigit((unsigned char)p[2]))) return (NULL); hex[0] = p[1]; diff --git a/usr.sbin/httpd/server_http.c b/usr.sbin/httpd/server_http.c index f64c892b9c8..504f3318fe1 100644 --- a/usr.sbin/httpd/server_http.c +++ b/usr.sbin/httpd/server_http.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server_http.c,v 1.99 2015/09/07 14:46:24 reyk Exp $ */ +/* $OpenBSD: server_http.c,v 1.100 2015/10/13 07:57:13 reyk Exp $ */ /* * Copyright (c) 2006 - 2015 Reyk Floeter <reyk@openbsd.org> @@ -918,7 +918,7 @@ server_expand_http(struct client *clt, const char *val, char *buf, /* Find previously matched substrings by index */ for (p = val; clt->clt_srv_match.sm_nmatch && (p = strstr(p, "%")) != NULL; p++) { - if (!isdigit(*(p + 1))) + if (!isdigit((unsigned char)*(p + 1))) continue; /* Copy number, leading '%' char and add trailing \0 */ |