[PATCH] selinux: fix segfault in virSecuritySELinuxMCSGetProcessRange

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

 



From: James Gilliland <neclimdul@xxxxxxxxx>

https://bugzilla.redhat.com/show_bug.cgi?id=969878
---
 src/security/security_selinux.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c
index b862fbf..3d8195c 100644
--- a/src/security/security_selinux.c
+++ b/src/security/security_selinux.c
@@ -189,6 +189,7 @@ virSecuritySELinuxMCSGetProcessRange(char **sens,
     context_t ourContext = NULL;
     char *cat = NULL;
     char *tmp;
+    char *contextRange;
     int ret = -1;
 
     if (getcon_raw(&ourSecContext) < 0) {
@@ -202,8 +203,14 @@ virSecuritySELinuxMCSGetProcessRange(char **sens,
                              ourSecContext);
         goto cleanup;
     }
+    if (!(contextRange = context_range_get(ourContext))) {
+        virReportSystemError(errno,
+                             _("Unable to parse current SELinux context range '%s'"),
+                             ourSecContext);
+        goto cleanup;
+    }
 
-    if (VIR_STRDUP(*sens, context_range_get(ourContext)) < 0)
+    if (VIR_STRDUP(*sens, contextRange) < 0)
         goto cleanup;
 
     /* Find and blank out the category part (if any) */
-- 
1.8.1.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]