mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-29 05:17:59 +00:00
Fix aa-mergeprof crash with files containing multiple profiles
If a profile file contains multiple profiles, aa-mergeprof crashes on saving in write_profile() because the second profile in the file is not listed in 'changed'. (This happens only if the second profile didn't change.) This patch first checks if 'changed' contains the profile before pop()ing it. Reproducer: copy utils/test/cleanprof_test.in to your profile directory and run aa-mergeprof utils/test/cleanprof_test.out. Then just press 's' to save the profile. Acked-by: Kshitij Gupta <kgupta8592@gmail.com> for trunk, 2.10 and 2.9
This commit is contained in:
parent
c2a7d975de
commit
83977cf7f4
@ -4070,7 +4070,11 @@ def write_profile(profile):
|
||||
|
||||
os.rename(newprof.name, prof_filename)
|
||||
|
||||
changed.pop(profile)
|
||||
if profile in changed:
|
||||
changed.pop(profile)
|
||||
else:
|
||||
debug_logger.info("Unchanged profile written: %s (not listed in 'changed' list)" % profile)
|
||||
|
||||
original_aa[profile] = deepcopy(aa[profile])
|
||||
|
||||
def matchliteral(aa_regexp, literal):
|
||||
|
Loading…
x
Reference in New Issue
Block a user