Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP1:GA
libvirt.1263
c6adccae-domain_conf-check-virSocketAddrFormat-...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File c6adccae-domain_conf-check-virSocketAddrFormat-errors.patch of Package libvirt.1263
From c6adccae3a3767753f278cefdf8e9e66b828da9a Mon Sep 17 00:00:00 2001 From: John Ferlan <jferlan@redhat.com> Date: Fri, 9 Jan 2015 11:02:05 -0500 Subject: [PATCH 7/7] domain_conf: Check errors from virSocketAddrFormat Commit id 'aa2cc721' added calls to virSocketAddrFormat but did not check for a NULL (error) return which could lead to bad output in the XML file. Need to check for NULL return and cause failure. Signed-off-by: John Ferlan <jferlan@redhat.com> --- src/conf/domain_conf.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) Index: libvirt-1.2.5/src/conf/domain_conf.c =================================================================== --- libvirt-1.2.5.orig/src/conf/domain_conf.c +++ libvirt-1.2.5/src/conf/domain_conf.c @@ -15706,7 +15706,7 @@ virDomainFSDefFormat(virBufferPtr buf, return 0; } -static void +static int virDomainNetIpsFormat(virBufferPtr buf, virDomainNetIpDefPtr *ips, size_t nips) { size_t i; @@ -15716,6 +15716,9 @@ virDomainNetIpsFormat(virBufferPtr buf, virSocketAddrPtr address = &ips[i]->address; char *ipStr = virSocketAddrFormat(address); const char *familyStr = NULL; + + if (!ipStr) + return -1; if (VIR_SOCKET_ADDR_IS_FAMILY(address, AF_INET6)) familyStr = "ipv6"; else if (VIR_SOCKET_ADDR_IS_FAMILY(address, AF_INET)) @@ -15729,6 +15732,7 @@ virDomainNetIpsFormat(virBufferPtr buf, virBufferAsprintf(buf, " prefix='%u'", ips[i]->prefix); virBufferAddLit(buf, "/>\n"); } + return 0; } static int @@ -15873,8 +15877,9 @@ virDomainHostdevDefFormatCaps(virBufferP virBufferAddLit(buf, "</source>\n"); if (def->source.caps.type == VIR_DOMAIN_HOSTDEV_CAPS_TYPE_NET) { - virDomainNetIpsFormat(buf, def->source.caps.u.net.ips, - def->source.caps.u.net.nips); + if (virDomainNetIpsFormat(buf, def->source.caps.u.net.ips, + def->source.caps.u.net.nips) < 0) + return -1; if (virDomainNetRoutesFormat(buf, def->source.caps.u.net.routes, def->source.caps.u.net.nroutes) < 0) return -1; @@ -16128,7 +16133,8 @@ virDomainNetDefFormat(virBufferPtr buf, return -1; } - virDomainNetIpsFormat(buf, def->ips, def->nips); + if (virDomainNetIpsFormat(buf, def->ips, def->nips) < 0) + return -1; if (virDomainNetRoutesFormat(buf, def->routes, def->nroutes) < 0) return -1;
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor