]> git.ipfire.org Git - thirdparty/grub.git/commit
mmap/mmap: Add missing grub_malloc() failure check
authorAvnish Chouhan <avnish@linux.ibm.com>
Tue, 28 Oct 2025 16:32:01 +0000 (22:02 +0530)
committerDaniel Kiper <daniel.kiper@oracle.com>
Thu, 6 Nov 2025 15:56:06 +0000 (16:56 +0100)
commit77e2ceb79a240d54445355317d2f4569c0550ae2
treefac26b0a75d21ef91771ff6f1e27f275d803fb5e
parent4cc22937e780f22d7b469d2da8df701957913de7
mmap/mmap: Add missing grub_malloc() failure check

This patch adds a NULL check after grub_malloc() call. Missing a failure
check after calling grub_malloc() can lead to undefined behavior. If the
allocation fails and returns NULL subsequent dereferencing or writing to
the pointer will likely result in a runtime error such as a segmentation
fault.

Signed-off-by: Avnish Chouhan <avnish@linux.ibm.com>
Reviewed-by: Sudhakar Kuppusamy <sudhakar@linux.ibm.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
grub-core/mmap/mmap.c