dcavalca / rpms / grub2

Forked from rpms/grub2 3 years ago
Clone

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

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