From 2e852f758b3fbc18ad30ec75d8c62b5d5238e70a Mon Sep 17 00:00:00 2001 From: Joakim Eriksson Date: Thu, 26 Nov 2015 14:19:12 +0100 Subject: [PATCH] added a null check on the lladdr before the memcmp. --- core/net/ipv6/uip-nd6.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/net/ipv6/uip-nd6.c b/core/net/ipv6/uip-nd6.c index 316172fb2..62b3a64cb 100644 --- a/core/net/ipv6/uip-nd6.c +++ b/core/net/ipv6/uip-nd6.c @@ -490,14 +490,16 @@ na_input(void) PRINTF("NA received is bad\n"); goto discard; } else { + const uip_lladdr_t *lladdr; nbr = uip_ds6_nbr_lookup(&UIP_ND6_NA_BUF->tgtipaddr); if(nbr == NULL) { goto discard; } + lladdr = uip_ds6_nbr_get_ll(nbr); if(nd6_opt_llao != NULL) { - is_llchange = - memcmp(&nd6_opt_llao[UIP_ND6_OPT_DATA_OFFSET], uip_ds6_nbr_get_ll(nbr), + is_llchange = lladdr == NULL || + memcmp(&nd6_opt_llao[UIP_ND6_OPT_DATA_OFFSET], lladdr, UIP_LLADDR_LEN); } if(nbr->state == NBR_INCOMPLETE) {