Patch-Source: https://src.fedoraproject.org/rpms/dnsmasq/blob/f36/f/0002-Add-safety-checks-to-places-pointed-by-Coverity.patch (backport from upstream) -- From 061013293ceddce509ae06a31a045e803103f1ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= Date: Wed, 18 Aug 2021 14:59:23 +0200 Subject: [PATCH 02/15] Add safety checks to places pointed by Coverity diff --git a/src/cache.c b/src/cache.c index 8add610..97c51a7 100644 --- a/src/cache.c +++ b/src/cache.c @@ -433,7 +433,7 @@ static struct crec *cache_scan_free(char *name, union all_addr *addr, unsigned s else if (!(crecp->flags & (F_HOSTS | F_DHCP | F_CONFIG)) && (flags & crecp->flags & F_REVERSE) && (flags & crecp->flags & (F_IPV4 | F_IPV6)) && - memcmp(&crecp->addr, addr, addrlen) == 0) + addr && memcmp(&crecp->addr, addr, addrlen) == 0) { *up = crecp->hash_next; cache_unlink(crecp); @@ -2013,7 +2013,7 @@ void log_query(unsigned int flags, char *name, union all_addr *addr, char *arg) else source = "cached"; - if (strlen(name) == 0) + if (name && !name[0]) name = "."; if (option_bool(OPT_EXTRALOG)) diff --git a/src/forward.c b/src/forward.c index 3d638e4..f07c908 100644 --- a/src/forward.c +++ b/src/forward.c @@ -2276,7 +2276,7 @@ int allocate_rfd(struct randfd_list **fdlp, struct server *serv) } } - if (j == daemon->numrrand) + if (!rfd) /* should be when j == daemon->numrrand */ { struct randfd_list *rfl_poll; -- 2.31.1