Skip to content

Commit

Permalink
Ignore IPv6 packets with payload after one with no Next Header (#500)
Browse files Browse the repository at this point in the history
IPv6 data packets with payload or padded bytes received after one with
no Next Header were not being parsed correctly, resulting in NULL PDU.

This commit fixes the IPv6 parser to be compliant with RFC 2460 Section
4.7 by adding a check in the IPv6 constructor to ignore the subsequent
packets if an IPv6 packet contains no Next Header.

Signed-off-by: James Raphael Tiovalen <jamestiotio@gmail.com>
  • Loading branch information
jamestiotio authored Apr 21, 2023
1 parent fa87e1b commit df509e7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/ipv6.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ IPv6::IPv6(const uint8_t* buffer, uint32_t total_sz) {
uint32_t actual_payload_length = payload_length();
bool is_payload_fragmented = false;
while (stream) {
if (is_extension_header(current_header)) {
if (is_extension_header(current_header) && current_header != NO_NEXT_HEADER) {
if (current_header == FRAGMENT) {
is_payload_fragmented = true;
}
Expand Down

0 comments on commit df509e7

Please sign in to comment.