2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-24 19:17:19 +00:00
Christian Boltz ee0ae96566 Merge [2.13+3.0] Use string startswith() and endswith() methods
... instead of slicing to check for prefixes and suffixes.

This change prevents a crash in aa-mergeprof - if `replacement` is empty,
trying to access `replacement[0]` causes an IndexError.
Using `.startswith()` works without crashing.

This backports parts of the severity.py changes in
commit 091c6ad59dc8a8fde26e1cbd812826a64421804d
by Mark Grassi.

I propose this fix for 2.13 and 3.0. (3.1 and master already have this fix.)

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/931
Approved-by: Jon Tourville <jon.tourville@canonical.com>
Merged-by: Christian Boltz <apparmor@cboltz.de>


(cherry picked from commit 7ebb25961066ab6cbacc7c59d4ff17450f94610b)

e1714b96 Use string startswith() and endswith() methods
2022-10-11 16:18:43 +00:00
..
2022-08-22 22:21:11 +02:00
2016-10-01 20:57:09 +02:00
2016-10-01 20:57:09 +02:00
2017-06-26 21:27:06 +02:00
2016-10-01 20:57:09 +02:00
2016-10-01 20:57:09 +02:00
2016-10-01 20:57:09 +02:00
2016-10-01 20:57:09 +02:00
2016-10-01 20:57:09 +02:00

Known Bugs: Will allow multiple letters in the () due to translation/unicode issues with regexing the key. User input will probably bug out in a different locale.