Blame SOURCES/0246-bootp-check-that-interface-is-not-NULL-in-configure_.patch

6b3c76
From 196938fb6e3eed1cf12d5a57a7e1f3ce59e344c3 Mon Sep 17 00:00:00 2001
a85e8e
From: Andrei Borzenkov <arvidjaar@gmail.com>
a85e8e
Date: Sun, 20 Mar 2016 10:32:33 +0300
6b3c76
Subject: [PATCH 246/261] bootp: check that interface is not NULL in
a85e8e
 configure_by_dhcp_ack
a85e8e
a85e8e
grub_net_add_addr may fail with OOM and we use returned interface
a85e8e
later without any checks.
a85e8e
---
a85e8e
 grub-core/net/bootp.c | 3 +++
a85e8e
 1 file changed, 3 insertions(+)
a85e8e
a85e8e
diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c
6b3c76
index 62d602d96..7df7f5511 100644
a85e8e
--- a/grub-core/net/bootp.c
a85e8e
+++ b/grub-core/net/bootp.c
a85e8e
@@ -237,6 +237,9 @@ grub_net_configure_by_dhcp_ack (const char *name,
a85e8e
   hwaddr.type = GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET;
a85e8e
 
a85e8e
   inter = grub_net_add_addr (name, card, &addr, &hwaddr, flags);
a85e8e
+  if (!inter)
a85e8e
+    return 0;
a85e8e
+
a85e8e
 #if 0
a85e8e
   /* This is likely based on misunderstanding. gateway_ip refers to
a85e8e
      address of BOOTP relay and should not be used after BOOTP transaction
6b3c76
-- 
6b3c76
2.13.5
6b3c76