Passing a NULL value for the argument secAlias to the function
qemuDomainGetTLSObjects can cause a segmentation fault in
libvirtd.
Fixed two possibile places where we could dereference a NULL secAlias.
Signed-off-by: Ashish Mittal <ashmit602(a)gmail.com>
---
src/qemu/qemu_hotplug.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 7dd6e5f..7592049 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -1638,12 +1638,14 @@ qemuDomainGetTLSObjects(virQEMUCapsPtr qemuCaps,
if (qemuBuildSecretInfoProps(secinfo, secProps) < 0)
return -1;
- if (!(*secAlias = qemuDomainGetSecretAESAlias(srcAlias, false)))
+ if (!secAlias ||
+ !(*secAlias = qemuDomainGetSecretAESAlias(srcAlias, false)))
return -1;
}
if (qemuBuildTLSx509BackendProps(tlsCertdir, tlsListen, tlsVerify,
- *secAlias, qemuCaps, tlsProps) < 0)
+ secAlias ? *secAlias : NULL, qemuCaps,
+ tlsProps) < 0)
return -1;
if (!(*tlsAlias = qemuAliasTLSObjFromSrcAlias(srcAlias)))
--
2.5.5