]> git.ipfire.org Git - thirdparty/grub.git/commit
partmap/msdos: Add missing grub_malloc() failure check
authorAvnish Chouhan <avnish@linux.ibm.com>
Tue, 28 Oct 2025 16:32:00 +0000 (22:02 +0530)
committerDaniel Kiper <daniel.kiper@oracle.com>
Thu, 6 Nov 2025 15:25:53 +0000 (16:25 +0100)
commit4cc22937e780f22d7b469d2da8df701957913de7
tree72e5233e85dd3e499e62f3563dc32b18be038f1a
parentc0d2f76d55fcbf433b3525a3f3c4aa7d697b1105
partmap/msdos: 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/partmap/msdos.c