[libvirt] [PATCH] xenconfig: fix issues found by coverity in multiple IP support

- virStringSplit may return NULL - VIR_ALLOC_N initialize the array already Cc: John Ferlan <jferlan@redhat.com> Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com> --- src/xenconfig/xen_common.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/xenconfig/xen_common.c b/src/xenconfig/xen_common.c index ff0df5fb7..ca3b4dee6 100644 --- a/src/xenconfig/xen_common.c +++ b/src/xenconfig/xen_common.c @@ -968,6 +968,9 @@ xenParseVif(virConfPtr conf, virDomainDefPtr def, const char *vif_typename) char **ip_list = virStringSplit(ip, " ", 0); size_t i; + if (!ip_list) + goto cleanup; + for (i = 0; ip_list[i]; i++) { if (virDomainNetAppendIPAddress(net, ip_list[i], 0, 0) < 0) { virStringListFree(ip_list); @@ -1191,8 +1194,6 @@ xenMakeIPList(virNetDevIPInfoPtr guestIP) if (!address_array[i]) goto cleanup; } - address_array[guestIP->nips] = NULL; - ret = virStringListJoin((const char**)address_array, " "); cleanup: -- 2.13.6

On 12/13/2017 02:15 PM, Marek Marczykowski-Górecki wrote:
- virStringSplit may return NULL - VIR_ALLOC_N initialize the array already
Cc: John Ferlan <jferlan@redhat.com> Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com> --- src/xenconfig/xen_common.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
Should have been two patches as they are separate... Probably could have had Michal alter his other patch too to remove that unnecessary setting of address_array... In any case, I split and pushed. Thanks - John
participants (2)
-
John Ferlan
-
Marek Marczykowski-Górecki