From e7d7dedcdb43bb30d9b700089685d56618a6a171 Mon Sep 17 00:00:00 2001 From: Jon Shallow Date: Fri, 8 Sep 2023 16:51:09 +0100 Subject: [PATCH] coap_address.c: Check for NULL ptr in is_bcast() --- src/coap_address.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coap_address.c b/src/coap_address.c index 6b36423d9f..2dabb366d9 100644 --- a/src/coap_address.c +++ b/src/coap_address.c @@ -216,7 +216,7 @@ coap_is_bcast(const coap_address_t *a) { last_refresh = now; ife = ifa; while (ife && bcst_cnt < COAP_BCST_CNT) { - if (ife->ifa_addr->sa_family == AF_INET && + if (ife->ifa_addr && ife->ifa_addr->sa_family == AF_INET && ife->ifa_flags & IFF_BROADCAST) { b_ipv4[bcst_cnt].s_addr = ((struct sockaddr_in *)ife->ifa_broadaddr)->sin_addr.s_addr; bcst_cnt++;