From 00f3986f7245ba50062cd91f8c8b31712f3525ad Mon Sep 17 00:00:00 2001 From: reyk Date: Tue, 13 Oct 2015 07:57:13 +0000 Subject: [PATCH] Pass unsigned chars to ctype functions. From Michael McConville --- usr.sbin/httpd/httpd.c | 7 ++++--- 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 @@ -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 @@ -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 */ -- 2.20.1