mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-31 14:25:52 +00:00
aa-status: fix crash due to \n in profile name
This fixes a crash when a profile name contains a \n character which breaks profile name parsing. The fix is minimal in that it ignores the bad profile name and continues processing. Ideally this name would not exist and is indicative of a bug in the kernel. Fixes: https://gitlab.com/apparmor/apparmor/-/issues/211 MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/824 Signed-off-by: John Johansen <john.johansen@canonical.com> Acked-by: Christian Boltz <apparmor@cboltz.de>
This commit is contained in:
@@ -135,7 +135,16 @@ static int get_profiles(struct profile **profiles, size_t *n) {
|
||||
while (getline(&line, &len, fp) != -1) {
|
||||
struct profile *_profiles;
|
||||
autofree char *status = NULL;
|
||||
autofree char *name = strdup(aa_splitcon(line, &status));
|
||||
autofree char *name = NULL;
|
||||
char *tmpname = aa_splitcon(line, &status);
|
||||
|
||||
if (!tmpname) {
|
||||
dfprintf(stderr, "Error: failed profile name split of '%s'.\n", line);
|
||||
ret = AA_EXIT_INTERNAL_ERROR;
|
||||
// skip this entry and keep processing
|
||||
continue;
|
||||
}
|
||||
name = strdup(tmpname);
|
||||
|
||||
if (status)
|
||||
status = strdup(status);
|
||||
|
Reference in New Issue
Block a user