Adds bound check before calling ndpi_handle_ipv6_extension_headers
This commit is contained in:
@@ -1700,6 +1700,9 @@ ether_type_check:
|
|||||||
iph6 = (struct ndpi_ipv6hdr *)&packet[ip_offset];
|
iph6 = (struct ndpi_ipv6hdr *)&packet[ip_offset];
|
||||||
proto = iph6->ip6_hdr.ip6_un1_nxt;
|
proto = iph6->ip6_hdr.ip6_un1_nxt;
|
||||||
ip_len = ntohs(iph6->ip6_hdr.ip6_un1_plen);
|
ip_len = ntohs(iph6->ip6_hdr.ip6_un1_plen);
|
||||||
|
if (header->caplen < ip_offset + sizeof(struct ndpi_ipv6hdr + ntohs(iph_v6->ip6_hdr.ip6_un1_plen))
|
||||||
|
return(nproto); /* Too short for IPv6 payload*/
|
||||||
|
|
||||||
|
|
||||||
const u_int8_t *l4ptr = (((const u_int8_t *) iph6) + sizeof(struct ndpi_ipv6hdr));
|
const u_int8_t *l4ptr = (((const u_int8_t *) iph6) + sizeof(struct ndpi_ipv6hdr));
|
||||||
if(ndpi_handle_ipv6_extension_headers(NULL, &l4ptr, &ip_len, &proto) != 0) {
|
if(ndpi_handle_ipv6_extension_headers(NULL, &l4ptr, &ip_len, &proto) != 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user