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
1 changed files with 3 additions and 0 deletions

View 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