From 7c52efa9093592ade59a986c5606450741fb8e59 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Thu, 23 Aug 2018 13:25:30 +0200 Subject: ofnet: Initialize structs in bootpath parser Code later on checks if variables inside the struct are 0 to see if they have been set, like if there were addresses in the bootpath. The variables were not initialized however, so the check might suceed with uninitialized data, and a new interface with random addresses has been added. This caused a weird bug in Ubuntu, because when booting from network, we now had two interfaces with the same name, and net_default_mac pointed to the random one. Bug-Ubuntu: https://bugs.launchpad.net/bugs/1785859 Signed-off-by: Julian Andres Klode Patch-Name: ofnet-init-structs-in-bootpath-parser.patch Forwarded: https://lists.gnu.org/archive/html/grub-devel/2018-08/msg00074.html Last-Update: 2018-08-23 --- grub-core/net/drivers/ieee1275/ofnet.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/grub-core/net/drivers/ieee1275/ofnet.c b/grub-core/net/drivers/ieee1275/ofnet.c index a78d164db..3a753658b 100644 --- grub-core/net/drivers/ieee1275/ofnet.c +++ grub-core/net/drivers/ieee1275/ofnet.c @@ -154,8 +154,8 @@ grub_ieee1275_parse_bootpath (const char *devpath, char *bootpath, char *equal_char = 0; grub_size_t field_counter = 0; - grub_net_network_level_address_t client_addr, gateway_addr, subnet_mask; - grub_net_link_level_address_t hw_addr; + grub_net_network_level_address_t client_addr = {}, gateway_addr = {}, subnet_mask = {}; + grub_net_link_level_address_t hw_addr = {}; grub_net_interface_flags_t flags = 0; struct grub_net_network_level_interface *inter = NULL;