loader/i386/xnu: Fix uninitialized scalar variable

In the function grub_xnu_boot(), 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 edi, and grub_uint32_t esi
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 375035

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>
This commit is contained in:
Alec Brown 2022-03-21 02:29:01 -04:00 committed by Daniel Kiper
parent 4fa5dd08f5
commit a97d1ebb8e

View File

@ -960,7 +960,7 @@ grub_xnu_boot (void)
grub_addr_t devtree_target;
grub_size_t devtreelen;
int i;
struct grub_relocator32_state state;
struct grub_relocator32_state state = {0};
grub_uint64_t fsbfreq = 100000000;
int v2 = (grub_xnu_darwin_version >= 11);
grub_uint32_t efi_system_table = 0;