Skip to content

Commit

Permalink
fix NULL pointer dereference get_ipv6_l4proto()
Browse files Browse the repository at this point in the history
get_ipv6_next() returns NULL on malformed packets. If that happens
return the last proto that could be read.

This should fix issue appneta#537
  • Loading branch information
GabrielGanne committed May 2, 2019
1 parent b819d66 commit 39b2786
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/common/get.c
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,8 @@ get_ipv6_l4proto(const ipv6_hdr_t *ip6_hdr, int len)
case TCPR_IPV6_NH_HBH:
dbgx(3, "Jumping to next extension header (0x%hhx)", proto);
exthdr = get_ipv6_next((struct tcpr_ipv6_ext_hdr_base *)ptr, len);
if (exthdr == NULL)
return proto;
proto = exthdr->ip_nh;
ptr = (u_char *)exthdr;
break;
Expand Down

0 comments on commit 39b2786

Please sign in to comment.