]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Explicitly cast chars to unsigned chars for <ctype.h> functions
authorOndřej Surý <ondrej@isc.org>
Wed, 20 Sep 2023 15:23:28 +0000 (17:23 +0200)
committerOndřej Surý <ondrej@isc.org>
Fri, 22 Sep 2023 15:01:59 +0000 (17:01 +0200)
Apply the semantic patch to catch all the places where we pass 'char' to
the <ctype.h> family of functions (isalpha() and friends, toupper(),
tolower()).

(cherry picked from commit 29caa6d1f0f32002245abfa838a5eb00dd7ed4e1)

contrib/dlz/modules/common/dlz_dbi.c
lib/dns/rdata.c
lib/isc/httpd.c

index 88ff6328f402ac1ac76df0c56cf60be965cc3984..d8e1909c44375a247f585b8dc7844818a08084a4 100644 (file)
@@ -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;
                }
index b7f9ed2b6125da53094342a740e3f54edd8a71a3..592b9746da1da5f411d0bf7b246ca27a4c669e7c 100644 (file)
@@ -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) {
index b15cc4544870f8b51824a0cb6e770360696fcc14..a93f9e13935ed87c456961223a2c29dfe53ee41c 100644 (file)
@@ -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;