Skip to content

parse_profile_data(): Ensure last line in a profile is valid

Christian Boltz requested to merge cboltz/apparmor:cboltz-parse-remainder into master

'lastline' gets merged into 'line' (and reset to None) when reading the next line. If 'lastline' isn't empty after reading the whole profile, this means there's something unparseable at the end of the profile, therefore parse_profile_data() should error out.

Also remove some simple_tests testcases from the 'exception_not_raised' list - they only didn't raise the exception because the invalid rule was the last line in the affected profile.

Thanks to Eric Chiang for accidently (and maybe even unnoticedly ;-) discovering this bug while adding some xattr testcases that surprisingly didn't fail in the tools.

I propose this patch for 2.12..master.

Merge request reports