mirror of
https://gitlab.com/apparmor/apparmor.git
synced 2025-03-04 08:24:42 +01: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:
parent
90b312c55a
commit
457ab38b93
1 changed files with 10 additions and 1 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue