]> git.hungrycats.org Git - linux/commit
ima: fix buffer overrun in ima_eventdigest_init_common
authorSamasth Norway Ananda <samasth.norway.ananda@oracle.com>
Wed, 7 Aug 2024 17:27:13 +0000 (10:27 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 22 Nov 2024 14:37:31 +0000 (15:37 +0100)
commite01aae58e818503f2ffcd34c6f7dc6f90af1057e
treed7e73a2edd6eb4bf18821321bac564dfad071b67
parent870d68fe17b5d9032049dcad98b5781a344a8657
ima: fix buffer overrun in ima_eventdigest_init_common

commit 923168a0631bc42fffd55087b337b1b6c54dcff5 upstream.

Function ima_eventdigest_init() calls ima_eventdigest_init_common()
with HASH_ALGO__LAST which is then used to access the array
hash_digest_size[] leading to buffer overrun. Have a conditional
statement to handle this.

Fixes: 9fab303a2cb3 ("ima: fix violation measurement list record")
Signed-off-by: Samasth Norway Ananda <samasth.norway.ananda@oracle.com>
Tested-by: Enrico Bravi (PhD at polito.it) <enrico.bravi@huawei.com>
Cc: stable@vger.kernel.org # 5.19+
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
security/integrity/ima/ima_template_lib.c