]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
cast (char) to (unsigned char) when calling is*()
authorMark Andrews <marka@isc.org>
Thu, 11 Mar 2021 00:08:54 +0000 (11:08 +1100)
committerMark Andrews <marka@isc.org>
Mon, 15 Mar 2021 03:18:03 +0000 (14:18 +1100)
lib/isc/netmgr/http.c
lib/isc/url.c

index 6de06a55cf9e72716bafc6a35d86d71ece9b0282..d3dd9a6b0e15c715fef202ab40e9eae9092eed8a 100644 (file)
@@ -2585,9 +2585,9 @@ typedef struct isc_httpparser_state {
 } isc_httpparser_state_t;
 
 #define MATCH(ch)      (st->str[0] == (ch))
-#define MATCH_ALPHA()  isalpha(st->str[0])
-#define MATCH_ALNUM()  isalnum(st->str[0])
-#define MATCH_XDIGIT() isxdigit(st->str[0])
+#define MATCH_ALPHA()  isalpha((unsigned char)(st->str[0]))
+#define MATCH_ALNUM()  isalnum((unsigned char)(st->str[0]))
+#define MATCH_XDIGIT() isxdigit((unsigned char)(st->str[0]))
 #define ADVANCE()      st->str++
 #define GETP()        (st->str)
 
index d4e13ee70a47d35ad6d16cc85d6343dde5e28707..e24ce362f191ec63d81fb9cdbfabaa0ab7544421 100644 (file)
@@ -191,15 +191,17 @@ typedef enum {
        ((c) == '-' || (c) == '_' || (c) == '.' || (c) == '!' || (c) == '~' || \
         (c) == '*' || (c) == '\'' || (c) == '(' || (c) == ')')
 #define IS_USERINFO_CHAR(c)                                                    \
-       (isalnum(c) || IS_MARK(c) || (c) == '%' || (c) == ';' || (c) == ':' || \
-        (c) == '&' || (c) == '=' || (c) == '+' || (c) == '$' || (c) == ',')
+       (isalnum((unsigned char)c) || IS_MARK(c) || (c) == '%' ||              \
+        (c) == ';' || (c) == ':' || (c) == '&' || (c) == '=' || (c) == '+' || \
+        (c) == '$' || (c) == ',')
 
 #if HTTP_PARSER_STRICT
 #define IS_URL_CHAR(c) (BIT_AT(normal_url_char, (unsigned char)c))
-#define IS_HOST_CHAR(c) (isalnum(c) || (c) == '.' || (c) == '-')
+#define IS_HOST_CHAR(c) (isalnum((unsigned char)c) || (c) == '.' || (c) == '-')
 #else
-#define IS_URL_CHAR(c) (BIT_AT(normal_url_char, (unsigned char)c) || ((c)&0x80))
-#define IS_HOST_CHAR(c) (isalnum(c) || (c) == '.' || (c) == '-' || (c) == '_')
+#define IS_URL_CHAR(c) (BIT_AT(normal_url_char, (unsigned char)c) || ((c)&0x80))
+#define IS_HOST_CHAR(c) \
+       (isalnum((unsigned char)c) || (c) == '.' || (c) == '-' || (c) == '_')
 #endif
 
 /*
@@ -237,14 +239,14 @@ parse_url_char(state_t s, const char ch) {
                        return (s_req_path);
                }
 
-               if (isalpha(ch)) {
+               if (isalpha((unsigned char)ch)) {
                        return (s_req_schema);
                }
 
                break;
 
        case s_req_schema:
-               if (isalpha(ch)) {
+               if (isalpha((unsigned char)ch)) {
                        return (s);
                }
 
@@ -410,7 +412,7 @@ http_parse_host_char(host_state_t s, const char ch) {
 
                /* FALLTHROUGH */
        case s_http_host_v6_start:
-               if (isxdigit(ch) || ch == ':' || ch == '.') {
+               if (isxdigit((unsigned char)ch) || ch == ':' || ch == '.') {
                        return (s_http_host_v6);
                }
 
@@ -427,8 +429,8 @@ http_parse_host_char(host_state_t s, const char ch) {
                /* FALLTHROUGH */
        case s_http_host_v6_zone_start:
                /* RFC 6874 Zone ID consists of 1*( unreserved / pct-encoded) */
-               if (isalnum(ch) || ch == '%' || ch == '.' || ch == '-' ||
-                   ch == '_' || ch == '~')
+               if (isalnum((unsigned char)ch) || ch == '%' || ch == '.' ||
+                   ch == '-' || ch == '_' || ch == '~')
                {
                        return (s_http_host_v6_zone);
                }
@@ -436,7 +438,7 @@ http_parse_host_char(host_state_t s, const char ch) {
 
        case s_http_host_port:
        case s_http_host_port_start:
-               if (isdigit(ch)) {
+               if (isdigit((unsigned char)ch)) {
                        return (s_http_host_port);
                }