]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
apparmor: enforce nullbyte at end of tag string
authorJann Horn <jannh@google.com>
Tue, 28 May 2019 15:32:26 +0000 (17:32 +0200)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 14 Aug 2019 09:18:49 +0000 (11:18 +0200)
commit811b0891cdaf93351642dc435ed0abd2277f81ad
tree34fef974f6edcd81876b81cbf4fe72d33427434a
parent6bf9e01b3fcd823a336559a04815ee621ef147ab
apparmor: enforce nullbyte at end of tag string

BugLink: https://bugs.launchpad.net/bugs/1838824
commit 8404d7a674c49278607d19726e0acc0cae299357 upstream.

A packed AppArmor policy contains null-terminated tag strings that are read
by unpack_nameX(). However, unpack_nameX() uses string functions on them
without ensuring that they are actually null-terminated, potentially
leading to out-of-bounds accesses.

Make sure that the tag string is null-terminated before passing it to
strcmp().

Cc: stable@vger.kernel.org
Fixes: 736ec752d95e ("AppArmor: policy routines for loading and unpacking policy")
Signed-off-by: Jann Horn <jannh@google.com>
Signed-off-by: John Johansen <john.johansen@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
security/apparmor/policy_unpack.c