From: reyk Date: Wed, 14 Oct 2015 07:58:14 +0000 (+0000) Subject: More (unsigned char) casts for ctype functions. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=d0296ba2e48bad29de44e7152788ac6ca4cf7aca;p=openbsd More (unsigned char) casts for ctype functions. Pointed out by Michael McConville --- diff --git a/usr.sbin/relayd/relayd.c b/usr.sbin/relayd/relayd.c index c881bab53bb..9fac1207a1c 100644 --- a/usr.sbin/relayd/relayd.c +++ b/usr.sbin/relayd/relayd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: relayd.c,v 1.143 2015/07/29 20:55:43 benno Exp $ */ +/* $OpenBSD: relayd.c,v 1.144 2015/10/14 07:58:14 reyk Exp $ */ /* * Copyright (c) 2007 - 2014 Reyk Floeter @@ -1366,7 +1366,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; @@ -1497,7 +1497,8 @@ get_string(u_int8_t *ptr, size_t len) char *str; for (i = 0; i < len; i++) - if (!(isprint(ptr[i]) || isspace(ptr[i]))) + if (!(isprint((unsigned char)ptr[i]) || + isspace((unsigned char)ptr[i]))) break; if ((str = calloc(1, i + 1)) == NULL)