The function assumes intname is not NULL. Declaring it with __attribute__ 
((nonnull)) exposes the issue.
---
 src/network.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/network.c b/src/network.c
index f6ac03b..b9786ad 100644
--- a/src/network.c
+++ b/src/network.c
@@ -1186,7 +1186,6 @@ int random_sock(int family)
   return -1;
 }
 
-
 int local_bind(int fd, union mysockaddr *addr, char *intname, int is_tcp)
 {
   union mysockaddr addr_copy = *addr;
@@ -1239,7 +1238,7 @@ static struct serverfd *allocate_sfd(union mysockaddr 
*addr, char *intname)
 #endif
     }
 
-  if (intname && strlen(intname) != 0)
+  if (!strlen(intname))
     ifindex = if_nametoindex(intname); /* index == 0 when not binding to an 
interface */
 
   /* may have a suitable one already */
-- 
2.14.2


_______________________________________________
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss

Reply via email to