Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/decode-ipv6.c
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,10 @@ static void DecodeIPV6ExtHdrs(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p,
/* length field for each opt */
uint8_t ip6_optlen = *(ptr + 1);

/* see if the optlen from the packet fits the total optslen */
if ((offset + 1 + ip6_optlen) > optslen) {
/* see if the optlen from the packet fits the total optslen.
* the option occupies 2 header bytes (type + len) plus
* ip6_optlen data bytes, so its data must end within optslen. */
if ((offset + 2 + ip6_optlen) > optslen) {
ENGINE_SET_INVALID_EVENT(p, IPV6_EXTHDR_INVALID_OPTLEN);
break;
}
Expand Down
Loading