Commit Diff
Diff:
71cac3a08bf84e8b9f8d52999df34913ef4efc55
6130e0eeac9db4fa8e6fe5934ec2d0ab202f979e
Commit:
6130e0eeac9db4fa8e6fe5934ec2d0ab202f979e
Tree:
1aff25c6cc404219c7f8f5e29f05da7e8caab24d
Author:
Omar Polo <op@omarpolo.com>
Date:
Thu Nov 17 09:21:38 2022 UTC
Message:
always cast is*() arguments to unsigned char
commit - 71cac3a08bf84e8b9f8d52999df34913ef4efc55
commit + 6130e0eeac9db4fa8e6fe5934ec2d0ab202f979e
blob - 35ccc2985f9b640d88daecd5040fe382ff070fe9
blob + e650737ba4036ad8f2cf7994a5f65969befe2e8f
--- gg.c
+++ gg.c
@@ -248,7 +248,9 @@ get(const char *r)
if (memmem(buf, len, "\r\n", 2) == NULL)
errx(1, "invalid reply: no \\r\\n");
- if (!isdigit(buf[0]) || !isdigit(buf[1]) || buf[2] != ' ')
+ if (!isdigit((unsigned char)buf[0]) ||
+ !isdigit((unsigned char)buf[1]) ||
+ buf[2] != ' ')
errx(1, "invalid reply: invalid response format");
code = (buf[0] - '0') * 10 + buf[1] - '0';
blob - 8725cdd504e5b6c8289d0e0594933c46c942c612
blob + c1f97814e86bd458862e6cd96d5557f1f8b4bd2d
--- iri.c
+++ iri.c
@@ -51,7 +51,8 @@ valid_pct_enc_string(char *s)
if (*s != '%')
return 1;
- if (!isxdigit(s[1]) || !isxdigit(s[2]))
+ if (!isxdigit((unsigned char)s[1]) ||
+ !isxdigit((unsigned char)s[2]))
return 0;
if (s[1] == '0' && s[2] == '0')
@@ -153,7 +154,7 @@ parse_port(struct parser *p)
p->parsed->port = p->iri;
- for (; isdigit(*p->iri); p->iri++) {
+ for (; isdigit((unsigned char)*p->iri); p->iri++) {
i = i * 10 + *p->iri - '0';
if (i > UINT16_MAX) {
p->err = "port number too large";
blob - 3c83a325ba92f2549125a474933bb47cfa353419
blob + 0ac83d6ea4ec78bc22aa8787d5c9551ff2dba7d9
--- proxy.c
+++ proxy.c
@@ -160,9 +160,9 @@ proxy_read(struct bufferevent *bev, void *d)
}
if (len < 3 || len > 1029 ||
- !isdigit(hdr[0]) ||
- !isdigit(hdr[1]) ||
- !isspace(hdr[2])) {
+ !isdigit((unsigned char)hdr[0]) ||
+ !isdigit((unsigned char)hdr[1]) ||
+ !isspace((unsigned char)hdr[2])) {
free(hdr);
log_warn(c, "upstream server is trying to send a "
"header that's too long.");
Omar Polo