AppArmor: Add mising end of structure test to caps unpacking
authorJohn Johansen <john.johansen@canonical.com>
Thu, 16 Feb 2012 15:06:41 +0000 (07:06 -0800)
committerJohn Johansen <john.johansen@canonical.com>
Mon, 27 Feb 2012 19:38:20 +0000 (11:38 -0800)
The unpacking of struct capsx is missing a check for the end of the
caps structure.  This can lead to unpack failures depending on what else
is packed into the policy file being unpacked.

Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Kees Cook <kees@ubuntu.com>

security/apparmor/policy_unpack.c

index 741dd13..5c46acf 100644 (file)
@@ -554,6 +554,8 @@ static struct aa_profile *unpack_profile(struct aa_ext *e)
                        goto fail;
                if (!unpack_u32(e, &(profile->caps.extended.cap[1]), NULL))
                        goto fail;
+               if (!unpack_nameX(e, AA_STRUCTEND, NULL))
+                       goto fail;
        }
 
        if (!unpack_rlimits(e, profile))