Skip to content

Commit 547e757

Browse files
himanshujha199640jukkar
authored andcommitted
net: llmnr_responder: Check return value of net_udp_get_hdr
net_udp_get_hdr() function returns NULL on failure. Therefore handle its return value to avoid potential NULL dereference. Fixes #11485 Coverity-CID: 189738 Signed-off-by: Himanshu Jha <[email protected]>
1 parent bf11698 commit 547e757

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

subsys/net/lib/dns/llmnr_responder.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@ static void create_ipv4_dst_addr(struct net_pkt *pkt,
9292
struct net_udp_hdr *udp_hdr, hdr;
9393

9494
udp_hdr = net_udp_get_hdr(pkt, &hdr);
95+
if (!udp_hdr) {
96+
NET_ERR("could not get UDP header");
97+
return;
98+
}
9599

96100
addr->sin_family = AF_INET;
97101
addr->sin_port = udp_hdr->src_port;

0 commit comments

Comments
 (0)