diff --git a/subsys/net/ip/ipv6.c b/subsys/net/ip/ipv6.c index 95ef6b72393..9bb23e95d78 100644 --- a/subsys/net/ip/ipv6.c +++ b/subsys/net/ip/ipv6.c @@ -554,7 +554,7 @@ int net_ipv6_find_last_ext_hdr(struct net_buf *buf) } out: - if (pos > frag->len) { + if (!frag || pos > frag->len) { pos = -EINVAL; }