From 0dc861ef6d21f30002f77f9146309a56c6dce18e Mon Sep 17 00:00:00 2001 From: Christian Boltz Date: Sun, 18 Oct 2015 22:24:15 +0200 Subject: [PATCH] Fix missing profile init in create_new_profile() create_new_profile() didn't init missing required_hats as profile_storage(), which might lead to crashes when creating a profile for an application listed in the required_hats config option (= in very rare cases). This patch adds the missing profile_storage() call. Acked-by: Kshitij Gupta --- utils/apparmor/aa.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/utils/apparmor/aa.py b/utils/apparmor/aa.py index 75132d9cb..68581a64e 100644 --- a/utils/apparmor/aa.py +++ b/utils/apparmor/aa.py @@ -470,6 +470,8 @@ def create_new_profile(localfile, is_stub=False): for hatglob in cfg['required_hats'].keys(): if re.search(hatglob, localfile): for hat in sorted(cfg['required_hats'][hatglob].split()): + if not local_profile.get(hat, False): + local_profile[hat] = profile_storage() local_profile[hat]['flags'] = 'complain' if not is_stub: