diff --git a/libdnet-stripped/src/eth-bsd.c b/libdnet-stripped/src/eth-bsd.c index eb9656869..b971194e0 100644 --- a/libdnet-stripped/src/eth-bsd.c +++ b/libdnet-stripped/src/eth-bsd.c @@ -133,12 +133,13 @@ eth_get(eth_t *e, eth_addr_t *ea) if (addr_ston((struct sockaddr *)sdl, &ha) == 0) break; } - free(buf); if (p >= buf + len) { + free(buf); errno = ESRCH; return (-1); } + free(buf); memcpy(ea, &ha.addr_eth, sizeof(*ea)); return (0); diff --git a/libnetutil/massdns.cc b/libnetutil/massdns.cc index 9c4559aa6..67471939c 100644 --- a/libnetutil/massdns.cc +++ b/libnetutil/massdns.cc @@ -1164,8 +1164,6 @@ bool DNS::ResolverImpl::process_result(const std::string &name, const DNS::Recor } const struct sockaddr_storage *ss = NULL; const DNS::A_Record *a_rec = NULL; - sockaddr_storage ip; - ip.ss_family = AF_UNSPEC; switch (reqt->type) { case DNS::A: case DNS::AAAA: @@ -1305,9 +1303,6 @@ void DNS::ResolverImpl::handle_read(nsock_pool nsp, nsock_event evt, dns_server return; } - sockaddr_storage ip; - ip.ss_family = AF_UNSPEC; - for(std::list::const_iterator it = p.answers.begin(); it != p.answers.end(); ++it ) { diff --git a/libnetutil/netutil.cc b/libnetutil/netutil.cc index 15bafdb58..5241ac644 100644 --- a/libnetutil/netutil.cc +++ b/libnetutil/netutil.cc @@ -229,10 +229,10 @@ int parse_ip_options(const char *txt, u8 *data, int datalen, int* firsthopoff, i case SLASH: // parse \x00 string if(*c == 'x'){// just ignore this char - base = 16; + base = 16; break; } - if(isxdigit(*c)){ + if(isxdigit((unsigned char)*c)){ strtolbyte = strtol(c, &n, base); if((strtolbyte < 0) || (strtolbyte > 255)){ if(errstr) Snprintf(errstr, errstrlen, "invalid ipv4 address format"); diff --git a/ncat/http.c b/ncat/http.c index 6e69bc932..c1ce688d9 100644 --- a/ncat/http.c +++ b/ncat/http.c @@ -1098,7 +1098,7 @@ static const char *parse_http_version(const char *s, enum http_version *version) /* Any version is accepted and not a parse error, * but only 1.0 and 1.1 are understood. */ q = p; - while (*q && (isdigit(*q) || (*q == '.' && dot++ == 0))) { + while (*q && (isdigit((unsigned char)*q) || (*q == '.' && dot++ == 0))) { q++; } if (*q != '\0' && *q != ' ' && !is_crlf(q)) { diff --git a/nsock/src/nsock_proxy.c b/nsock/src/nsock_proxy.c index c64f1c918..44630933c 100644 --- a/nsock/src/nsock_proxy.c +++ b/nsock/src/nsock_proxy.c @@ -298,11 +298,11 @@ static int parse_uri(const char *proxystr, const char *end, struct uri *uri) { /* Scheme, section 3.1. */ p = proxystr; - if (!isalpha(*p)) + if (!isalpha((unsigned char)*p)) goto fail; q = p; - while (isalpha(*q) || isdigit(*q) || *q == '+' || *q == '-' || *q == '.') { + while (isalpha((unsigned char)*q) || isdigit((unsigned char)*q) || *q == '+' || *q == '-' || *q == '.') { q++; if (q >= end) goto fail; diff --git a/string_pool.cc b/string_pool.cc index 99de9607f..4b50aa63f 100644 --- a/string_pool.cc +++ b/string_pool.cc @@ -90,7 +90,7 @@ class StringPoolItem { // asdfq <> asdf bool operator< (const StringPoolItem& other) const { - return this->len < other.len || this->len == other.len && memcmp(this->str, other.str, other.len) < 0; + return this->len < other.len || (this->len == other.len && memcmp(this->str, other.str, other.len) < 0); } };