]> git.ipfire.org Git - thirdparty/grub.git/commit
disk/diskfilter: Check calloc() result for NULL
authorDaniel Axtens <dja@axtens.net>
Sun, 21 Aug 2022 12:22:35 +0000 (22:22 +1000)
committerDaniel Kiper <daniel.kiper@oracle.com>
Tue, 11 Oct 2022 12:49:39 +0000 (14:49 +0200)
commit12e20a6a695f4967b30a95bb52e4e2e0a10c9094
treedecad321468bdd07f1ab0a26b138f5fde0a214c4
parent3cf2e848bc03c44d30bb87e583d12efe7e7ccf75
disk/diskfilter: Check calloc() result for NULL

With wildly corrupt inputs, we can end up trying to calloc a very
large amount of memory, which will fail and give us a NULL pointer.
We need to check that to avoid a crash. (And, even if we blocked
such inputs, it is good practice to check the results of allocations
anyway.)

Signed-off-by: Daniel Axtens <dja@axtens.net>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
grub-core/disk/diskfilter.c