]> git.ipfire.org Git - thirdparty/grub.git/commit
loader/multiboot_elfxx: Check program memory isn't larger than allocated memory size
authorAlec Brown <alec.r.brown@oracle.com>
Mon, 22 May 2023 20:52:46 +0000 (16:52 -0400)
committerDaniel Kiper <daniel.kiper@oracle.com>
Thu, 25 May 2023 14:47:59 +0000 (16:47 +0200)
commit9537ddb0e7f2c080042d2c617d412197fa957a8d
treee545e9831cb34fe67fd5d32cbdc5a7eb7d626d30
parent1c0df7c142c546b856c3dbc916bfd786367427c0
loader/multiboot_elfxx: Check program memory isn't larger than allocated memory size

In grub-core/loader/multiboot_elfxx.c, the code is filling an area of memory
with grub_memset() but doesn't check if there is space in the allocated memory
before doing so. To make sure we aren't zeroing memory past the allocated memory
region, we need to check that the offset into the allocated memory region plus
the memory size of the program is smaller than the allocated memory size.

Fixes: CID 314029
Fixes: CID 314038
Signed-off-by: Alec Brown <alec.r.brown@oracle.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
grub-core/loader/multiboot_elfxx.c