85f98a
From dcb4fa04548ab2364f662b735be86e275bd50745 Mon Sep 17 00:00:00 2001
85f98a
From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= <pemensik@redhat.com>
85f98a
Date: Fri, 19 Jul 2019 14:00:08 +0200
85f98a
Subject: [PATCH] Remove warnings in coverity
85f98a
85f98a
Change in dnsmasq should never occur, because ent_pw would not change.
85f98a
But keep Coverity happy and prevent logic error. Second change avoids
85f98a
warning from compiler.
85f98a
---
85f98a
 src/dnsmasq.c | 9 ++++++++-
85f98a
 src/option.c  | 2 +-
85f98a
 2 files changed, 9 insertions(+), 2 deletions(-)
85f98a
85f98a
diff --git a/src/dnsmasq.c b/src/dnsmasq.c
85f98a
index ce44809..2984f55 100644
85f98a
--- a/src/dnsmasq.c
85f98a
+++ b/src/dnsmasq.c
85f98a
@@ -608,7 +608,14 @@ int main (int argc, char **argv)
85f98a
   
85f98a
       if (ent_pw && ent_pw->pw_uid != 0)
85f98a
 	{     
85f98a
-#if defined(HAVE_LINUX_NETWORK)	  
85f98a
+#if defined(HAVE_LINUX_NETWORK)
85f98a
+	  if (!hdr || !data)
85f98a
+	    {
85f98a
+	      /* Just failsafe for logic errors */
85f98a
+	      send_event(err_pipe[1], EVENT_CAP_ERR, ENOMEM, NULL);
85f98a
+	      _exit(0);
85f98a
+	    }
85f98a
+
85f98a
 	  /* On linux, we keep CAP_NETADMIN (for ARP-injection) and
85f98a
 	     CAP_NET_RAW (for icmp) if we're doing dhcp. If we have yet to bind 
85f98a
 	     ports because of DAD, or we're doing it dynamically,
85f98a
diff --git a/src/option.c b/src/option.c
85f98a
index 9768efb..b12183b 100644
85f98a
--- a/src/option.c
85f98a
+++ b/src/option.c
85f98a
@@ -4255,7 +4255,7 @@ err:
85f98a
 		struct name_list *nl;
85f98a
 		if (!canon)
85f98a
                   {
85f98a
-		    struct name_list *tmp = new->names, *next;
85f98a
+		    struct name_list *tmp, *next;
85f98a
 		    for (tmp = new->names; tmp; tmp = next)
85f98a
 		      {
85f98a
 			next = tmp->next;
85f98a
-- 
85f98a
2.20.1
85f98a