Discussion:
[PATCH] ieee1275/ofnet.c: Fix uninitialized ipv4 field
Michael Chang
2018-07-19 09:36:54 UTC
Permalink
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(+)

Index: grub-2.02/grub-core/net/drivers/ieee1275/ofnet.c
===================================================================
--- grub-2.02.orig/grub-core/net/drivers/ieee1275/ofnet.c
+++ 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

Loading...