mirror of
https://github.com/torvalds/linux.git
synced 2026-06-07 22:14:04 +02:00
apparmor: enforce nullbyte at end of tag string
commit8404d7a674upstream. 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:736ec752d9("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>
This commit is contained in:
parent
eb2b0bf5c4
commit
31c9958068
|
|
@ -276,7 +276,7 @@ static bool unpack_nameX(struct aa_ext *e, enum aa_code code, const char *name)
|
|||
char *tag = NULL;
|
||||
size_t size = unpack_u16_chunk(e, &tag);
|
||||
/* if a name is specified it must match. otherwise skip tag */
|
||||
if (name && (!size || strcmp(name, tag)))
|
||||
if (name && (!size || tag[size-1] != '\0' || strcmp(name, tag)))
|
||||
goto fail;
|
||||
} else if (name) {
|
||||
/* if a name is specified and there is no name tag fail */
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user