From 5967380c2034dc3d2d518324e513246306ac0347 Mon Sep 17 00:00:00 2001 From: Dirk Ziegelmeier Date: Fri, 5 May 2017 09:07:40 +0200 Subject: [PATCH] netif_add: avoid passing NULL pointers to subsequent functions (reported by Axel Lin) --- src/core/netif.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/core/netif.c b/src/core/netif.c index f9b60077..994bc4fd 100644 --- a/src/core/netif.c +++ b/src/core/netif.c @@ -281,6 +281,16 @@ netif_add(struct netif *netif, LWIP_ASSERT("No init function given", init != NULL); + if (ipaddr == NULL) { + ipaddr = ip_2_ip4(IP4_ADDR_ANY); + } + if (netmask == NULL) { + netmask = ip_2_ip4(IP4_ADDR_ANY); + } + if (gw == NULL) { + gw = ip_2_ip4(IP4_ADDR_ANY); + } + /* reset new interface configuration state */ #if LWIP_IPV4 ip_addr_set_zero_ip4(&netif->ip_addr);