Security-plugin: Fix the null pointer comparison
authorElena Reshetova <elena.reshetova@intel.com>
Fri, 31 May 2013 12:51:38 +0000 (15:51 +0300)
committerElena Reshetova <elena.reshetova@intel.com>
Fri, 31 May 2013 12:51:38 +0000 (15:51 +0300)
 possibility in msmXattrSupport

plugins/msmxattr.c

index 75aca54d9d483ce9497ad0506a65319cfbcecf14..146481a92bcb4f3514de55714ae5c36fa2ace51c 100644 (file)
@@ -1153,7 +1153,8 @@ int msmSetFileXAttributes(manifest_x *mfx, const char* filepath, magic_t cookie)
                     goto found;
                 }
                 len = strlen(filesystem->path);
-                rpmlog(RPMLOG_DEBUG, "filesystem->path: %s, length %d\n", filesystem->path, len);
+                rpmlog(RPMLOG_DEBUG, "filepath: %s, filesystem->type %s\n", filepath, filesystem->type);
+                rpmlog(RPMLOG_DEBUG, "filesystem->path: %s, length %d, match %d\n", filesystem->path, len, match);
                 rpmlog(RPMLOG_DEBUG, "filesystem->path + len - 1: %s\n", filesystem->path + len - 1);
                 if (len > match) {
                     if ((!strncmp(filepath, filesystem->path, len)) && (filesystem->type)) {
@@ -1180,8 +1181,8 @@ int msmSetFileXAttributes(manifest_x *mfx, const char* filepath, magic_t cookie)
     if (exec_label) {
         execLabeldefined = 1;
         if ((strcmp(exec_label, "none") == 0) 
-            || (strcmp(exec_label, mfx->request->ac_domain) == 0)
-            || (strcmp(exec_label, mfx->define->name) == 0)) {
+            || ( (mfx->request) && (mfx->request->ac_domain) && (strcmp(exec_label, mfx->request->ac_domain) == 0))
+            || ( (mfx->define) &&  (mfx->define->name) && (strcmp(exec_label, mfx->define->name) == 0))) {
             // these labels are allowed
         } else {
             // ignore all other exec labels, because they aren't allowed for security reasons