Skip to content
Snippets Groups Projects
Commit e821a018 authored by Christian Boltz's avatar Christian Boltz
Browse files

Merge branch 'cboltz-unbalanced-parenthesis' into 'master'

Fix crash on unbalanced parenthesis in filename

See merge request apparmor/apparmor!402

Seth Arnold <seth.arnold@canonical.com> for 2.10..master

(cherry picked from commit db1f3918)

8f74ac02 Fix crash on unbalanced parenthesis in filename
parent e78ef3f7
No related branches found
No related tags found
No related merge requests found
type=AVC msg=audit(1562529588.082:3153): apparmor="DENIED" operation="open" profile="unbalanced_parenthesis" name="/dev/shm/test(me" pid=888 comm="cat" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
START
File: unbalanced_parenthesis.in
Event type: AA_RECORD_DENIED
Audit ID: 1562529588.082:3153
Operation: open
Mask: r
Denied Mask: r
fsuid: 1000
ouid: 1000
Profile: unbalanced_parenthesis
Name: /dev/shm/test(me
Command: cat
PID: 888
Epoch: 1562529588
Audit subid: 3153
profile unbalanced_parenthesis {
owner /dev/shm/test(me r,
}
......@@ -213,6 +213,9 @@ def hasher():
def convert_regexp(regexp):
regex_paren = re.compile('^(.*){([^}]*)}(.*)$')
regexp = regexp.strip()
regexp = regexp.replace('(', '\\(').replace(')', '\\)') # escape '(' and ')'
new_reg = re.sub(r'(?<!\\)(\.|\+|\$)', r'\\\1', regexp)
while regex_paren.search(new_reg):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment