From df509e7e36474c9b19c30686895d58b6aad0546a Mon Sep 17 00:00:00 2001 From: James R T Date: Fri, 21 Apr 2023 12:22:01 +0800 Subject: [PATCH] Ignore IPv6 packets with payload after one with no Next Header (#500) 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 --- src/ipv6.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ipv6.cpp b/src/ipv6.cpp index 416065b..189de88 100644 --- a/src/ipv6.cpp +++ b/src/ipv6.cpp @@ -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; }