]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
bootp: check that interface is not NULL in configure_by_dhcp_ack
authorAndrei Borzenkov <arvidjaar@gmail.com>
Sun, 20 Mar 2016 07:32:33 +0000 (10:32 +0300)
committerAndrei Borzenkov <arvidjaar@gmail.com>
Sun, 20 Mar 2016 07:32:33 +0000 (10:32 +0300)
grub_net_add_addr may fail with OOM and we use returned interface
later without any checks.

grub-core/net/bootp.c

index 09c6f7606aa13f5a680908b4f6cdaf7b2f5ce010..189551a483ab9413cdca27650b20267268fa724a 100644 (file)
@@ -157,6 +157,9 @@ grub_net_configure_by_dhcp_ack (const char *name,
   hwaddr.type = GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET;
 
   inter = grub_net_add_addr (name, card, &addr, &hwaddr, flags);
+  if (!inter)
+    return 0;
+
 #if 0
   /* This is likely based on misunderstanding. gateway_ip refers to
      address of BOOTP relay and should not be used after BOOTP transaction