From e89b48d23f2c3874beebaf15fb17c0158f524d13 Mon Sep 17 00:00:00 2001 From: Dirk Ziegelmeier Date: Wed, 2 Mar 2016 23:44:51 +0100 Subject: [PATCH] raw.c: Avoid NULL pointer dereference --- src/core/raw.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/core/raw.c b/src/core/raw.c index 794a3643..440e2b82 100644 --- a/src/core/raw.c +++ b/src/core/raw.c @@ -434,8 +434,10 @@ raw_new_ip6(u8_t proto) struct raw_pcb *pcb; pcb = raw_new(proto); #if LWIP_IPV4 - IP_SET_TYPE_VAL(pcb->local_ip, IPADDR_TYPE_V6); - IP_SET_TYPE_VAL(pcb->remote_ip, IPADDR_TYPE_V6); + if(pcb != NULL) { + IP_SET_TYPE_VAL(pcb->local_ip, IPADDR_TYPE_V6); + IP_SET_TYPE_VAL(pcb->remote_ip, IPADDR_TYPE_V6); + } #endif /* LWIP_IPV4 */ return pcb; }