mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-31 22:35:35 +00:00
Detect endless #include loop when parsing profiles
If an include file includes itsself (for example if local/foo has
'#include <local/foo>'), print a warning instead of calling
load_include() again and again.
This fixes a crash when hitting such a case:
RecursionError: maximum recursion depth exceeded while calling a Python object
Fixes: https://bugzilla.suse.com/show_bug.cgi?id=1184779 for the tools.
The parser will also need a fix.
This is the 3.0 version of 30323a2ded
/
https://gitlab.com/apparmor/apparmor/-/merge_requests/742
This commit is contained in:
@@ -1948,7 +1948,11 @@ def parse_profile_data(data, file, do_include):
|
||||
active_profiles.add_inc_ie(file, rule_obj)
|
||||
|
||||
for incname in rule_obj.get_full_paths(profile_dir):
|
||||
load_include(incname)
|
||||
if incname == file:
|
||||
# warn about endless loop, and don't call load_include() (again) for this file
|
||||
aaui.UI_Important(_('WARNING: endless loop detected: file %s includes itsself' % incname))
|
||||
else:
|
||||
load_include(incname)
|
||||
|
||||
elif NetworkRule.match(line):
|
||||
if not profile:
|
||||
|
Reference in New Issue
Block a user