diff --git a/components/lwip/apps/dhcpserver/dhcpserver.c b/components/lwip/apps/dhcpserver/dhcpserver.c index 6f432eb8433..d8b01c0c85c 100644 --- a/components/lwip/apps/dhcpserver/dhcpserver.c +++ b/components/lwip/apps/dhcpserver/dhcpserver.c @@ -1239,11 +1239,19 @@ static s16_t parse_msg(dhcps_t *dhcps, struct dhcps_msg *m, u16_t len) pnode = NULL; } else { pdhcps_pool = (struct dhcps_pool *)mem_calloc(1, sizeof(struct dhcps_pool)); + if (pdhcps_pool == NULL) { + return 0; + } pdhcps_pool->ip.addr = dhcps->client_address.addr; memcpy(pdhcps_pool->mac, m->chaddr, sizeof(pdhcps_pool->mac)); pdhcps_pool->lease_timer = lease_timer; pnode = (list_node *)mem_calloc(1, sizeof(list_node)); + if (pnode == NULL) { + mem_free(pdhcps_pool); + pdhcps_pool = NULL; + return 0; + } pnode->pnode = pdhcps_pool; pnode->pnext = NULL; diff --git a/components/lwip/lwip b/components/lwip/lwip index 9d2d804124d..c6f2f878e7b 160000 --- a/components/lwip/lwip +++ b/components/lwip/lwip @@ -1 +1 @@ -Subproject commit 9d2d804124d0ada89777cfac83e0df2cfdef117d +Subproject commit c6f2f878e7b0f86033214b85547d579be43351e3 diff --git a/components/lwip/port/hooks/lwip_default_hooks.c b/components/lwip/port/hooks/lwip_default_hooks.c index 1ec6e75814f..ee5f5332e01 100644 --- a/components/lwip/port/hooks/lwip_default_hooks.c +++ b/components/lwip/port/hooks/lwip_default_hooks.c @@ -234,6 +234,9 @@ void dhcp_parse_extra_opts(struct dhcp *dhcp, uint8_t state, uint8_t option, uin NETIF_FOREACH(netif) { /* find the netif related to this dhcp */ if (dhcp == netif_dhcp_data(netif)) { + if (mtu < 68) { /* RFC 2132 requires MTU >= 68 */ + return; + } if (mtu < netif->mtu) { netif->mtu = mtu; LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("dhcp_parse_extra_opts(): Negotiated netif MTU is %d\n", netif->mtu));