commit 97c63ac4bc839a924d281e8942f90d3a4e8e59dd from: Stefan Sperling via: Thomas Adam date: Sat Jul 26 10:36:08 2025 UTC add missing casts to ctype function arguments in gotsys parse.y spotted by op@ commit - 46fa6498d5de78cc0dce21a09958993f0ebc274d commit + 97c63ac4bc839a924d281e8942f90d3a4e8e59dd blob - 97555fb391c138b895b056ac33aa9ae9bf247c3d blob + 242e46a968fe0b2194b050837f83b63dbd7d2e56 --- gotsys/parse.y +++ gotsys/parse.y @@ -735,7 +735,7 @@ top: yyerror("string too long"); return (findeol()); } - if (isalnum(c) || c == '_') { + if (isalnum((unsigned char)c) || c == '_') { *p++ = c; continue; } @@ -835,12 +835,13 @@ nodigits: } #define allowed_in_string(x) \ - (isalnum(x) || (ispunct(x) && x != '(' && x != ')' && \ + (isalnum((unsigned char)x) || \ + (ispunct((unsigned char)x) && x != '(' && x != ')' && \ x != '{' && x != '}' && \ x != '!' && x != '=' && x != '#' && \ x != ',')) - if (isalnum(c) || c == ':' || c == '_') { + if (isalnum((unsigned char)c) || c == ':' || c == '_') { do { *p++ = c; if ((unsigned)(p-buf) >= sizeof(buf)) { @@ -1316,7 +1317,7 @@ email_address_is_valid(const char *s) return 0; for (i = 0; i < local_len; i++) { - if (isalnum(s[i])) + if (isalnum((unsigned char)s[i])) continue; for (j = 0; j < nitems(allowed); j++) { @@ -1340,7 +1341,7 @@ email_address_is_valid(const char *s) return 0; for (i = local_len + 1; i < domain_len; i++) { - if (isalnum(s[i]) || s[i] == '.' || s[i] == '-') + if (isalnum((unsigned char)s[i]) || s[i] == '.' || s[i] == '-') continue; return 0; @@ -1575,7 +1576,7 @@ parse_url(char **proto, char **host, char **port, host_len = strlen(*host); for (i = 0; i < host_len; i++) { - if (isalnum((*host)[i]) || + if (isalnum((unsigned char)(*host)[i]) || (*host)[i] == '.' || (*host)[i] == '-') continue; err = got_error_fmt(GOT_ERR_PARSE_URI, @@ -1623,7 +1624,7 @@ basic_auth_user_is_valid(const char *s) if (s[i] & 0x80) return 0; - if (isalnum(s[i]) || + if (isalnum((unsigned char)s[i]) || (i > 0 && s[i] == '-') || (i > 0 && s[i] == '_') || (i > 0 && s[i] == '.')) @@ -1647,7 +1648,7 @@ basic_auth_password_is_valid(const char *s) for (i = 0; i < len; i++) { if (s[i] & 0x80) return 0; - if (iscntrl(s[i])) + if (iscntrl((unsigned char)s[i])) return 0; if (s[i] == '"') return 0;