diff --git a/CHANGES b/CHANGES index e369897266..c8ae14b0ab 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +5598. [port] Cast (char) to (unsigned char) when calling ctype + tests. [GL #2567] + 5597. [bug] When serve-stale was enabled and starting the recursive resolution process for a query failed, a named instance could crash if it was configured as both a recursive and diff --git a/lib/isc/netmgr/http.c b/lib/isc/netmgr/http.c index 6de06a55cf..d3dd9a6b0e 100644 --- a/lib/isc/netmgr/http.c +++ b/lib/isc/netmgr/http.c @@ -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) diff --git a/lib/isc/url.c b/lib/isc/url.c index d4e13ee70a..e24ce362f1 100644 --- a/lib/isc/url.c +++ b/lib/isc/url.c @@ -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); }