]> git.ipfire.org Git - thirdparty/grub.git/commit
lib/legacy_parse: Add missing grub_malloc() failure check
authorAvnish Chouhan <avnish@linux.ibm.com>
Tue, 28 Oct 2025 16:32:02 +0000 (22:02 +0530)
committerDaniel Kiper <daniel.kiper@oracle.com>
Thu, 6 Nov 2025 16:21:18 +0000 (17:21 +0100)
commitd4f476f08e66aded4c8d99628280c9de14befd64
treea041933471026473ccc18ba26df0416616091694
parent77e2ceb79a240d54445355317d2f4569c0550ae2
lib/legacy_parse: 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/lib/legacy_parse.c