From: Ondřej Surý Date: Wed, 20 Sep 2023 15:23:28 +0000 (+0200) Subject: Explicitly cast chars to unsigned chars for functions X-Git-Tag: v9.18.20~39^2~1 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=818f4dc3a7c08267768f56e69b64ae360d8cc8e9;p=thirdparty%2Fbind9.git Explicitly cast chars to unsigned chars for functions Apply the semantic patch to catch all the places where we pass 'char' to the family of functions (isalpha() and friends, toupper(), tolower()). (cherry picked from commit 29caa6d1f0f32002245abfa838a5eb00dd7ed4e1) --- diff --git a/contrib/dlz/modules/common/dlz_dbi.c b/contrib/dlz/modules/common/dlz_dbi.c index 88ff6328f40..d8e1909c443 100644 --- a/contrib/dlz/modules/common/dlz_dbi.c +++ b/contrib/dlz/modules/common/dlz_dbi.c @@ -474,7 +474,7 @@ get_parameter_value(const char *input, const char *key) { for (i = 0; i < 255; i++) { value[i] = keystart[keylen + i]; - if (isspace(value[i]) || value[i] == '\0') { + if (isspace((unsigned char)value[i]) || value[i] == '\0') { value[i] = '\0'; break; } diff --git a/lib/dns/rdata.c b/lib/dns/rdata.c index b7f9ed2b612..592b9746da1 100644 --- a/lib/dns/rdata.c +++ b/lib/dns/rdata.c @@ -2059,7 +2059,7 @@ decvalue(char value) { * isascii() is valid for full range of int values, no need to * mask or cast. */ - if (!isascii(value)) { + if (!isascii((unsigned char)value)) { return (-1); } if ((s = strchr(decdigits, value)) == NULL) { diff --git a/lib/isc/httpd.c b/lib/isc/httpd.c index b15cc454487..a93f9e13935 100644 --- a/lib/isc/httpd.c +++ b/lib/isc/httpd.c @@ -340,8 +340,10 @@ value_match(const struct phr_header *header, const char *match) { limit = header->value_len - match_len + 1; for (size_t i = 0; i < limit; i++) { - if (isspace(header->value[i])) { - while (i < limit && isspace(header->value[i])) { + if (isspace((unsigned char)header->value[i])) { + while (i < limit && + isspace((unsigned char)header->value[i])) + { i++; } continue;