From: John Ferlan Date: Thu, 11 Jul 2013 14:33:29 +0000 (-0400) Subject: virsh-nodedev: Resolve Coverity issues X-Git-Tag: CVE-2013-4154~43 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f926804a91732ed9218000d9a983b928d616ac48;p=thirdparty%2Flibvirt.git virsh-nodedev: Resolve Coverity issues Recent changes uncovered FORWARD_NULL and NEGATIVE_RETURNS problems with the processing of the 'ndevices' and its associated allocated arrays in 'vshNodeDeviceListCollect' due to the possibility of returning -1 in a call and using the returned value as a for loop index end condition. --- diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c index 2eb197985d..32550796ce 100644 --- a/tools/virsh-nodedev.c +++ b/tools/virsh-nodedev.c @@ -352,7 +352,7 @@ finished: success = true; cleanup: - for (i = 0; i < ndevices; i++) + for (i = 0; ndevices != -1 && i < ndevices; i++) VIR_FREE(names[i]); VIR_FREE(names);