]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
net/net: Fix uninitialized scalar variable
authorAlec Brown <alec.r.brown@oracle.com>
Mon, 21 Mar 2022 06:29:00 +0000 (02:29 -0400)
committerDaniel Kiper <daniel.kiper@oracle.com>
Mon, 4 Apr 2022 18:28:54 +0000 (20:28 +0200)
In the function grub_net_ipv6_get_link_local(), grub_net_network_level_address_t
addr is called but isn't being initialized. This results in the member
grub_dns_option_t option being filled with junk data from the stack. We can
prevent this by setting the option member in addr to 0.

Fixes: CID 375033
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/net/net.c

index 11b39877b993678d2d84e8bd091cfa55b4cad9c6..681f91486264f33ae70e735bebe3bc32b2f89ce8 100644 (file)
@@ -292,6 +292,7 @@ grub_net_ipv6_get_link_local (struct grub_net_card *card,
   addr.type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV6;
   addr.ipv6[0] = grub_cpu_to_be64_compile_time (0xfe80ULL << 48);
   addr.ipv6[1] = grub_net_ipv6_get_id (hwaddr);
+  addr.option = 0;
 
   FOR_NET_NETWORK_LEVEL_INTERFACES (inf)
   {