mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-08-25 07:33:11 +00:00
dhcp: Prevent NULL pointer dereference in dhcp_select
Move the code to make sure netif is not NULL before calling netif_dhcp_data(netif). Signed-off-by: Axel Lin <axel.lin@ingics.com>
This commit is contained in:
parent
596f742066
commit
d73efd7d38
@ -365,7 +365,7 @@ dhcp_handle_offer(struct netif *netif, struct dhcp_msg *msg_in)
|
|||||||
static err_t
|
static err_t
|
||||||
dhcp_select(struct netif *netif)
|
dhcp_select(struct netif *netif)
|
||||||
{
|
{
|
||||||
struct dhcp *dhcp = netif_dhcp_data(netif);
|
struct dhcp *dhcp;
|
||||||
err_t result;
|
err_t result;
|
||||||
u16_t msecs;
|
u16_t msecs;
|
||||||
u8_t i;
|
u8_t i;
|
||||||
@ -373,6 +373,7 @@ dhcp_select(struct netif *netif)
|
|||||||
u16_t options_out_len;
|
u16_t options_out_len;
|
||||||
|
|
||||||
LWIP_ERROR("dhcp_select: netif != NULL", (netif != NULL), return ERR_ARG;);
|
LWIP_ERROR("dhcp_select: netif != NULL", (netif != NULL), return ERR_ARG;);
|
||||||
|
dhcp = netif_dhcp_data(netif);
|
||||||
LWIP_ERROR("dhcp_select: dhcp != NULL", (dhcp != NULL), return ERR_VAL;);
|
LWIP_ERROR("dhcp_select: dhcp != NULL", (dhcp != NULL), return ERR_VAL;);
|
||||||
|
|
||||||
LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("dhcp_select(netif=%p) %c%c%"U16_F"\n", (void *)netif, netif->name[0], netif->name[1], (u16_t)netif->num));
|
LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("dhcp_select(netif=%p) %c%c%"U16_F"\n", (void *)netif, netif->name[0], netif->name[1], (u16_t)netif->num));
|
||||||
|
Loading…
Reference in New Issue
Block a user