Skip to content

Commit 4f0889f

Browse files
m-pellizzergregkh
authored andcommitted
apparmor: fix memory leak in verify_header
commit e38c55d upstream. The function sets `*ns = NULL` on every call, leaking the namespace string allocated in previous iterations when multiple profiles are unpacked. This also breaks namespace consistency checking since *ns is always NULL when the comparison is made. Remove the incorrect assignment. The caller (aa_unpack) initializes *ns to NULL once before the loop, which is sufficient. Fixes: dd51c84 ("apparmor: provide base for multiple profiles to be replaced at once") Reported-by: Qualys Security Advisory <qsa@qualys.com> Tested-by: Salvatore Bonaccorso <carnil@debian.org> Reviewed-by: Georgia Garcia <georgia.garcia@canonical.com> Reviewed-by: Cengiz Can <cengiz.can@canonical.com> Signed-off-by: Massimiliano Pellizzer <massimiliano.pellizzer@canonical.com> Signed-off-by: John Johansen <john.johansen@canonical.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 0baadb0 commit 4f0889f

1 file changed

Lines changed: 0 additions & 1 deletion

File tree

security/apparmor/policy_unpack.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1177,7 +1177,6 @@ static int verify_header(struct aa_ext *e, int required, const char **ns)
11771177
{
11781178
int error = -EPROTONOSUPPORT;
11791179
const char *name = NULL;
1180-
*ns = NULL;
11811180

11821181
/* get the interface version */
11831182
if (!aa_unpack_u32(e, &e->version, "version")) {

0 commit comments

Comments
 (0)