[PATCH v4] Avoid possible NULL pointer dereferences in qemuDomainGetTLSObjects

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux