]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
loader/i386/xnu: Fix uninitialized scalar variable
authorAlec Brown <alec.r.brown@oracle.com>
Mon, 21 Mar 2022 06:28:59 +0000 (02:28 -0400)
committerDaniel Kiper <daniel.kiper@oracle.com>
Mon, 4 Apr 2022 18:28:55 +0000 (20:28 +0200)
In the function grub_xnu_boot_resume(), struct grub_relocator32_state state is
called but isn't being initialized. This results in the members grub_uint32_t
ebx, grub_uint32_t ecx, grub_uint32_t edx, grub_uint32_t esi, and grub_uint32_t
edi being filled with junk data from the stack since none of them are being set
to any values. We can prevent this by setting state to {0}.

Fixes: CID 375031
Signed-off-by: Alec Brown <alec.r.brown@oracle.com>
Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
grub-core/loader/i386/xnu.c

index c516d0c6c62688086e498100d9c475a4ef769aa9..da962175f5269ab5b18a5f32f1305b0cfe0de552 100644 (file)
@@ -805,7 +805,7 @@ grub_cpu_xnu_fill_devicetree (grub_uint64_t *fsbfreq_out)
 grub_err_t
 grub_xnu_boot_resume (void)
 {
-  struct grub_relocator32_state state;
+  struct grub_relocator32_state state = {0};
 
   state.esp = grub_xnu_stack;
   state.ebp = grub_xnu_stack;