From 2652c0e5a97259f1676ec89855da1058e27926c7 Mon Sep 17 00:00:00 2001 From: Jaakko Hannikainen Date: Mon, 1 Aug 2016 15:04:59 +0300 Subject: [PATCH] net: contiki: Add NULL check to neighbor polling The function is getting called with NULL bufs, so uip_len cannot be called on them. The stack further down handles NULL buffers correctly. Jira: ZEP-474 Change-Id: I85fb045ec76bea2a83c64d0f72eabba4e661f5f4 Signed-off-by: Jaakko Hannikainen --- net/ip/contiki/ipv6/uip-ds6-nbr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/ip/contiki/ipv6/uip-ds6-nbr.c b/net/ip/contiki/ipv6/uip-ds6-nbr.c index 411ee3fa712..660b15e22a3 100644 --- a/net/ip/contiki/ipv6/uip-ds6-nbr.c +++ b/net/ip/contiki/ipv6/uip-ds6-nbr.c @@ -273,7 +273,7 @@ uip_ds6_neighbor_periodic(struct net_buf *buf) case NBR_INCOMPLETE: if(nbr->nscount >= UIP_ND6_MAX_MULTICAST_SOLICIT) { uip_ds6_nbr_rm(nbr); - } else if(stimer_expired(&nbr->sendns) && (uip_len(buf) == 0)) { + } else if(stimer_expired(&nbr->sendns) && (!buf || uip_len(buf) == 0)) { nbr->nscount++; PRINTF("NBR_INCOMPLETE: NS %u\n", nbr->nscount); uip_nd6_ns_output(buf, NULL, NULL, &nbr->ipaddr); @@ -298,7 +298,7 @@ uip_ds6_neighbor_periodic(struct net_buf *buf) } } uip_ds6_nbr_rm(nbr); - } else if(stimer_expired(&nbr->sendns) && (uip_len(buf) == 0)) { + } else if(stimer_expired(&nbr->sendns) && (!buf || uip_len(buf) == 0)) { nbr->nscount++; PRINTF("PROBE: NS %u\n", nbr->nscount); uip_nd6_ns_output(buf, NULL, &nbr->ipaddr, &nbr->ipaddr);