Fix extension header parsing. Credit: Himanshu Anand

This commit is contained in:
dmiller 2026-06-25 21:58:49 +00:00
parent 8769ab35f3
commit bb6754e76b

View file

@ -700,11 +700,13 @@ static const u8 *ipv6_get_data_primitive(const struct ip6_hdr *ip6, const u8 *pa
*nxt = ip6->ip6_nxt;
p += sizeof(*ip6);
while (p < end && ipv6_is_extension_header(*nxt)) {
if (p + 2 > end)
if (p + 8 > end)
return NULL;
*nxt = *p;
p += (*(p + 1) + 1) * 8;
}
if (p >= end)
return NULL;
*len = end - p;
if (upperlayer_only && !ipv6_is_upperlayer(*nxt))