]> xenbits.xensource.com Git - libvirt.git/commitdiff
security: Fix comparison for virSecuritySELinuxRecallLabel
authorJohn Ferlan <jferlan@redhat.com>
Thu, 20 Dec 2018 21:30:24 +0000 (16:30 -0500)
committerJohn Ferlan <jferlan@redhat.com>
Fri, 21 Dec 2018 11:03:44 +0000 (06:03 -0500)
The @con type security_context_t is actually a "char *", so the
correct check should be to dereference one more level; otherwise,
we could return/use the NULL pointer later in a subsequent
virSecuritySELinuxSetFileconImpl call (using @fcon).

Suggested-by: Michal Prívozník <mprivozn@redhat.com>
Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/security/security_selinux.c

index f3690a4cb148d81e59987d4a06a197c06b624d96..5cdb839c13fc06de579f64b74795ede613a8c1c4 100644 (file)
@@ -211,7 +211,7 @@ virSecuritySELinuxRecallLabel(const char *path,
                                       path, con) < 0)
         return -1;
 
-    if (!con)
+    if (!*con)
         return 1;
 
     return 0;