bootp: check that interface is not NULL in configure_by_dhcp_ack

grub_net_add_addr may fail with OOM and we use returned interface
later without any checks.
This commit is contained in:
Andrei Borzenkov 2016-03-20 10:32:33 +03:00
parent 5b8ddf6e03
commit 6714d7ecff

View file

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