Skip to content

Commit f05841a

Browse files
committed
apparmor: fail unpack if profile mode is unknown
Profile unpack should fail if the profile mode is not a mode that the kernel understands. Signed-off-by: John Johansen <john.johansen@canonical.com>
1 parent 3ed4aaa commit f05841a

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

‎security/apparmor/policy_unpack.c‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -748,10 +748,14 @@ static struct aa_profile *unpack_profile(struct aa_ext *e, char **ns_name)
748748
goto fail;
749749
if (tmp == PACKED_MODE_COMPLAIN || (e->version & FORCE_COMPLAIN_FLAG))
750750
profile->mode = APPARMOR_COMPLAIN;
751+
else if (tmp == PACKED_MODE_ENFORCE)
752+
profile->mode = APPARMOR_ENFORCE;
751753
else if (tmp == PACKED_MODE_KILL)
752754
profile->mode = APPARMOR_KILL;
753755
else if (tmp == PACKED_MODE_UNCONFINED)
754756
profile->mode = APPARMOR_UNCONFINED;
757+
else
758+
goto fail;
755759
if (!unpack_u32(e, &tmp, NULL))
756760
goto fail;
757761
if (tmp)

0 commit comments

Comments
 (0)