apparmor: avoid crash when parsed profile name is empty
[linux-2.6-microblaze.git] / security / apparmor / policy_unpack.c
index 9575da5..dbf7d96 100644 (file)
@@ -832,6 +832,10 @@ static struct aa_profile *unpack_profile(struct aa_ext *e, char **ns_name)
 
        tmpname = aa_splitn_fqname(name, strlen(name), &tmpns, &ns_len);
        if (tmpns) {
+               if (!tmpname) {
+                       info = "empty profile name";
+                       goto fail;
+               }
                *ns_name = kstrndup(tmpns, ns_len, GFP_KERNEL);
                if (!*ns_name) {
                        info = "out of memory";