From: John Ferlan Date: Thu, 4 Sep 2014 21:59:20 +0000 (-0400) Subject: network_conf: Resolve Coverity FORWARD_NULL X-Git-Tag: CVE-2014-3633~90 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8ffab1010a78e2cd14860f8bc02527c6f35209d6;p=thirdparty%2Flibvirt.git network_conf: Resolve Coverity FORWARD_NULL The code compares def->forwarders when deciding to return 0 at a couple of points, then uses "def->nfwds" as a way to index into the def->forwarders array. That reference results in Coverity complaining that def->forwarders being NULL was checked as part of an arithmetic OR operation where failure could be any one 5 conditions, but that is not checked when entering the loop to dereference the array. Changing the comparisons to use nfwds will clear the warnings Signed-off-by: John Ferlan --- diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c index 9571ee1c58..f013d6b0e7 100644 --- a/src/conf/network_conf.c +++ b/src/conf/network_conf.c @@ -2360,7 +2360,7 @@ virNetworkDNSDefFormat(virBufferPtr buf, { size_t i, j; - if (!(def->forwardPlainNames || def->forwarders || def->nhosts || + if (!(def->forwardPlainNames || def->nfwds || def->nhosts || def->nsrvs || def->ntxts)) return 0; @@ -2376,7 +2376,7 @@ virNetworkDNSDefFormat(virBufferPtr buf, return -1; } virBufferAsprintf(buf, " forwardPlainNames='%s'", fwd); - if (!(def->forwarders || def->nhosts || def->nsrvs || def->ntxts)) { + if (!(def->nfwds || def->nhosts || def->nsrvs || def->ntxts)) { virBufferAddLit(buf, "/>\n"); return 0; }