[PATCH 2/3] security_dac: Avoid segfault when no label is requested

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

 



When no DAC "label" was requested for a domain the DAC manager tried to
strdup a NULL string causing a segfault.
---
 src/security/security_dac.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/security/security_dac.c b/src/security/security_dac.c
index 925498f..4162e26 100644
--- a/src/security/security_dac.c
+++ b/src/security/security_dac.c
@@ -890,6 +890,7 @@ virSecurityDACGenLabel(virSecurityManagerPtr mgr,
         break;
     case VIR_DOMAIN_SECLABEL_NONE:
         /* no op */
+        return 0;
         break;
     default:
         virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -899,7 +900,7 @@ virSecurityDACGenLabel(virSecurityManagerPtr mgr,
     }

     if (!seclabel->norelabel) {
-        if (seclabel->imagelabel == NULL) {
+        if (seclabel->imagelabel == NULL && seclabel->label != NULL) {
             seclabel->imagelabel = strdup(seclabel->label);
             if (seclabel->imagelabel == NULL) {
                 virReportError(VIR_ERR_INTERNAL_ERROR,
-- 
1.7.12

--
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]