From 903a613f9f72e1509bb04cd57b5f320fe7e4d39e Mon Sep 17 00:00:00 2001 From: Alexey A Tikhonov Date: Tue, 30 May 2023 15:36:52 +0300 Subject: [PATCH] Remove unreachable code as reported by Coverity (#527) Coverity reported some code as unreachable. A manual inspection confirmed the reports. Fix By: Alexey A Tikhonov (@alexey-tikhonov) --- src/lib/ares__readaddrinfo.c | 4 ---- src/lib/ares_getaddrinfo.c | 2 +- src/lib/ares_parse_uri_reply.c | 3 --- 3 files changed, 1 insertion(+), 8 deletions(-) diff --git a/src/lib/ares__readaddrinfo.c b/src/lib/ares__readaddrinfo.c index 2315df94..f0b3dcf1 100644 --- a/src/lib/ares__readaddrinfo.c +++ b/src/lib/ares__readaddrinfo.c @@ -197,10 +197,6 @@ int ares__readaddrinfo(FILE *fp, } } - if (status != ARES_SUCCESS) - /* Ignore line if invalid address string for the requested family. */ - continue; - if (want_cname) { for (i = 0; i < alias_count; ++i) diff --git a/src/lib/ares_getaddrinfo.c b/src/lib/ares_getaddrinfo.c index cb494242..7ba8e91a 100644 --- a/src/lib/ares_getaddrinfo.c +++ b/src/lib/ares_getaddrinfo.c @@ -825,7 +825,7 @@ static int as_is_first(const struct host_query* hquery) char* p; int ndots = 0; size_t nname = hquery->name?strlen(hquery->name):0; - for (p = hquery->name; *p; p++) + for (p = hquery->name; p && *p; p++) { if (*p == '.') { diff --git a/src/lib/ares_parse_uri_reply.c b/src/lib/ares_parse_uri_reply.c index d79b5c4d..bb282675 100644 --- a/src/lib/ares_parse_uri_reply.c +++ b/src/lib/ares_parse_uri_reply.c @@ -151,9 +151,6 @@ ares_parse_uri_reply (const unsigned char *abuf, int alen, uri_curr->uri = strncpy(uri_curr->uri, (const char *)vptr, rr_len-4); uri_curr->uri[rr_len-4]='\0'; uri_curr->ttl = rr_ttl; - - if (status != ARES_SUCCESS) - break; } /* Don't lose memory in the next iteration */