mirror of https://github.com/omar-polo/gmid.git
always cast is*() arguments to unsigned char
backport of6130e0e
and06035a0
This commit is contained in:
parent
4107583e32
commit
52772181b5
4
gg.c
4
gg.c
|
@ -248,7 +248,9 @@ get(const char *r)
|
||||||
|
|
||||||
if (memmem(buf, len, "\r\n", 2) == NULL)
|
if (memmem(buf, len, "\r\n", 2) == NULL)
|
||||||
errx(1, "invalid reply: no \\r\\n");
|
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");
|
errx(1, "invalid reply: invalid response format");
|
||||||
|
|
||||||
code = (buf[0] - '0') * 10 + buf[1] - '0';
|
code = (buf[0] - '0') * 10 + buf[1] - '0';
|
||||||
|
|
11
iri.c
11
iri.c
|
@ -22,7 +22,7 @@
|
||||||
static inline int
|
static inline int
|
||||||
unreserved(int p)
|
unreserved(int p)
|
||||||
{
|
{
|
||||||
return isalnum(p)
|
return isalnum((unsigned char)p)
|
||||||
|| p == '-'
|
|| p == '-'
|
||||||
|| p == '.'
|
|| p == '.'
|
||||||
|| p == '_'
|
|| p == '_'
|
||||||
|
@ -51,7 +51,8 @@ valid_pct_enc_string(char *s)
|
||||||
if (*s != '%')
|
if (*s != '%')
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
if (!isxdigit(s[1]) || !isxdigit(s[2]))
|
if (!isxdigit((unsigned char)s[1]) ||
|
||||||
|
!isxdigit((unsigned char)s[2]))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (s[1] == '0' && s[2] == '0')
|
if (s[1] == '0' && s[2] == '0')
|
||||||
|
@ -108,7 +109,7 @@ parse_scheme(struct parser *p)
|
||||||
{
|
{
|
||||||
p->parsed->schema = p->iri;
|
p->parsed->schema = p->iri;
|
||||||
|
|
||||||
if (!isalpha(*p->iri)) {
|
if (!isalpha((unsigned char)*p->iri)) {
|
||||||
p->err = "illegal character in scheme";
|
p->err = "illegal character in scheme";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -125,7 +126,7 @@ parse_scheme(struct parser *p)
|
||||||
*/
|
*/
|
||||||
*p->iri = tolower(*p->iri);
|
*p->iri = tolower(*p->iri);
|
||||||
p->iri++;
|
p->iri++;
|
||||||
} while (isalnum(*p->iri)
|
} while (isalnum((unsigned char)*p->iri)
|
||||||
|| *p->iri == '+'
|
|| *p->iri == '+'
|
||||||
|| *p->iri == '-'
|
|| *p->iri == '-'
|
||||||
|| *p->iri == '.');
|
|| *p->iri == '.');
|
||||||
|
@ -153,7 +154,7 @@ parse_port(struct parser *p)
|
||||||
|
|
||||||
p->parsed->port = p->iri;
|
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';
|
i = i * 10 + *p->iri - '0';
|
||||||
if (i > UINT16_MAX) {
|
if (i > UINT16_MAX) {
|
||||||
p->err = "port number too large";
|
p->err = "port number too large";
|
||||||
|
|
6
proxy.c
6
proxy.c
|
@ -160,9 +160,9 @@ proxy_read(struct bufferevent *bev, void *d)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (len < 3 || len > 1029 ||
|
if (len < 3 || len > 1029 ||
|
||||||
!isdigit(hdr[0]) ||
|
!isdigit((unsigned char)hdr[0]) ||
|
||||||
!isdigit(hdr[1]) ||
|
!isdigit((unsigned char)hdr[1]) ||
|
||||||
!isspace(hdr[2])) {
|
!isspace((unsigned char)hdr[2])) {
|
||||||
free(hdr);
|
free(hdr);
|
||||||
log_warn(c, "upstream server is trying to send a "
|
log_warn(c, "upstream server is trying to send a "
|
||||||
"header that's too long.");
|
"header that's too long.");
|
||||||
|
|
6
server.c
6
server.c
|
@ -1334,9 +1334,9 @@ cgi_read(struct bufferevent *bev, void *d)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (len < 3 || len > 1029 ||
|
if (len < 3 || len > 1029 ||
|
||||||
!isdigit(header[0]) ||
|
!isdigit((unsigned char)header[0]) ||
|
||||||
!isdigit(header[1]) ||
|
!isdigit((unsigned char)header[1]) ||
|
||||||
!isspace(header[2])) {
|
!isspace((unsigned char)header[2])) {
|
||||||
free(header);
|
free(header);
|
||||||
log_warn(client, "CGI script is trying to send a "
|
log_warn(client, "CGI script is trying to send a "
|
||||||
"malformed header");
|
"malformed header");
|
||||||
|
|
Loading…
Reference in New Issue