mirror of
https://gitlab.com/apparmor/apparmor.git
synced 2025-03-04 16:35:02 +01:00
utils/aa-status: don't crash when non-ASCII mountpoints are in use
Merge from trunk revision 2892 aa-status was crashing when parsing through /proc/mounts looking to see if and where the securityfs synthetic file system is mounted if there was a mount point that contained characters outside of the charset in use in the environment of aa-status. This patch fixes the issue by converting the read of /proc/mounts into a binary read and then uses decode on the elements. Patch by Alain BENEDETTI. Acked-by: Steve Beattie <steve@nxnw.org>
This commit is contained in:
parent
9428498d90
commit
735ef5d32b
1 changed files with 4 additions and 4 deletions
|
@ -134,10 +134,10 @@ def filter_processes(processes, status):
|
|||
|
||||
def find_apparmorfs():
|
||||
'''Finds AppArmor mount point'''
|
||||
for p in open("/proc/mounts").readlines():
|
||||
if p.split()[2] == "securityfs" and \
|
||||
os.path.exists(os.path.join(p.split()[1], "apparmor")):
|
||||
return os.path.join(p.split()[1], "apparmor")
|
||||
for p in open("/proc/mounts","rb").readlines():
|
||||
if p.split()[2].decode() == "securityfs" and \
|
||||
os.path.exists(os.path.join(p.split()[1].decode(), "apparmor")):
|
||||
return os.path.join(p.split()[1].decode(), "apparmor")
|
||||
return False
|
||||
|
||||
def errormsg(message):
|
||||
|
|
Loading…
Add table
Reference in a new issue