dcavalca / rpms / grub2

Forked from rpms/grub2 3 years ago
Clone

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

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