Skip to content

Commit 73b1687

Browse files
committed
Merge pull request #35 from adamgreen/fixNullIpAddrBug
Don't dereference NULL ipaddr in netif_set_ipaddr()
2 parents 4d26e2e + e0fb0a8 commit 73b1687

File tree

1 file changed

+6
-0
lines changed
  • libraries/net/lwip/lwip/core

1 file changed

+6
-0
lines changed

libraries/net/lwip/lwip/core/netif.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,12 @@ netif_find(char *name)
318318
void
319319
netif_set_ipaddr(struct netif *netif, ip_addr_t *ipaddr)
320320
{
321+
/* Protect against dereferencing NULL pointers by
322+
treating like ANY, as does ip_addr_set() */
323+
if (!ipaddr) {
324+
ipaddr = IP_ADDR_ANY;
325+
}
326+
321327
/* TODO: Handling of obsolete pcbs */
322328
/* See: http://mail.gnu.org/archive/html/lwip-users/2003-03/msg00118.html */
323329
#if LWIP_TCP

0 commit comments

Comments
 (0)