2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-09-05 00:35:13 +00:00

Update to log parsing to correctly unpack the hex encoded values passed

from the module: name, name2, and profile. (fix from jmichael@suse.de)
This commit is contained in:
Dominic Reynolds
2007-09-17 01:58:36 +00:00
parent 0cd4b39f4c
commit 4ffd798b57

View File

@@ -2070,11 +2070,13 @@ sub parse_log_record_v_2_1 ($) {
s/\s$//;
# audit_log_untrustedstring() is used for name, name2, and profile in
# order to escape strings with special characters
for my $key (keys %$e) {
# if we have an even number of hex characters...
if ($key eq "name" && $e->{$key} =~ /^([0-9a-f]{2})+$/i) {
# unpack the hex string.
# NOTE: this might need unpack("h", ...) instead of "H"
next unless $key =~ /^(name|name2|profile)$/;
# needs to be an even number of hex characters
if ($e->{$key} =~ /^([0-9a-f]{2})+$/i) {
# convert the hex string back to a raw string
$e->{$key} = pack("H*", $e->{$key});
}
}