]> git.ipfire.org Git - thirdparty/grub.git/commit
lib/relocator: Fix dereference after NULL check
authorVladimir Serbinenko <phcoder@gmail.com>
Wed, 19 Nov 2025 06:37:32 +0000 (06:37 +0000)
committerDaniel Kiper <daniel.kiper@oracle.com>
Thu, 20 Nov 2025 16:28:00 +0000 (17:28 +0100)
commitae69b464bedfdf4da9147124dce28cbebf3bb3d9
treef425211c399961773ec78e5da69ecf79a6f9a36d
parent1a5417f39a0ccefcdd5440f2a67f84d2d2e26960
lib/relocator: Fix dereference after NULL check

In the function free_subchunk(), after checking that subchu->post isn't NULL,
grub_memset() is called on subchu->pre->freebytes but it should be called on
subchu->post->freebytes. If subchu->pre is NULL but subchu->post isn't NULL,
then this could lead to a NULL pointer dereference.

Fixes: CID 473882
Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com>
Signed-off-by: Alec Brown <alec.r.brown@oracle.com>
Reviewed-by: Sudhakar Kuppusamy <sudhakar@linux.ibm.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
grub-core/lib/relocator.c