Skip to contentSkip to conversation

ieee1275/ofnet.c: Fix uninitialized ipv4 field

PATCH New Michael Chang 1 participant 1 message Jul 19, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ieee1275/ofnet.c: Fix uninitialized ipv4 field

The ipv4 address field is not initialized to zero that would make the subsequent check to become false positive. The outcome is broken network interface being created with garbage value which may potentially break network connectivity.

This patch fixes the problem by initializing them to zero as needed by subsequent checks.

---
 grub-core/net/drivers/ieee1275/ofnet.c | 3 +++
 1 file changed, 3 insertions(+)
grub-core/net/drivers/ieee1275/ofnet.c +3 -0
Index: grub-2.02/grub-core/net/drivers/ieee1275/ofnet.c
===================================================================
@@ -160,6 +160,9 @@ grub_ieee1275_parse_bootpath (const char
   grub_uint32_t vlantag = 0;
 
   hw_addr.type = GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET;
+  client_addr.ipv4 = 0;
+  gateway_addr.ipv4 = 0;
+  subnet_mask.ipv4 = 0;
 
   args = bootpath + grub_strlen (devpath) + 1;
   do