added a null check on the lladdr before the memcmp.

This commit is contained in:
Joakim Eriksson 2015-11-26 14:19:12 +01:00
parent 223f002676
commit 2e852f758b

View file

@ -490,14 +490,16 @@ na_input(void)
PRINTF("NA received is bad\n"); PRINTF("NA received is bad\n");
goto discard; goto discard;
} else { } else {
const uip_lladdr_t *lladdr;
nbr = uip_ds6_nbr_lookup(&UIP_ND6_NA_BUF->tgtipaddr); nbr = uip_ds6_nbr_lookup(&UIP_ND6_NA_BUF->tgtipaddr);
if(nbr == NULL) { if(nbr == NULL) {
goto discard; goto discard;
} }
lladdr = uip_ds6_nbr_get_ll(nbr);
if(nd6_opt_llao != NULL) { if(nd6_opt_llao != NULL) {
is_llchange = is_llchange = lladdr == NULL ||
memcmp(&nd6_opt_llao[UIP_ND6_OPT_DATA_OFFSET], uip_ds6_nbr_get_ll(nbr), memcmp(&nd6_opt_llao[UIP_ND6_OPT_DATA_OFFSET], lladdr,
UIP_LLADDR_LEN); UIP_LLADDR_LEN);
} }
if(nbr->state == NBR_INCOMPLETE) { if(nbr->state == NBR_INCOMPLETE) {