From eab17406dbe9d1ffb4140f59eaef6045ad24fcfc Mon Sep 17 00:00:00 2001 From: yagel-dev <1234yagel@gmail.com> Date: Wed, 9 Oct 2024 17:16:09 +0300 Subject: [PATCH 1/2] IP option "End of options" might not coincide with header len As in RFC 791: "This [End of Option List] might not coincide with the end of the internet header according to the internet header length." --- src/ip.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ip.cpp b/src/ip.cpp index 897ebed0..3e764cf3 100644 --- a/src/ip.cpp +++ b/src/ip.cpp @@ -111,8 +111,8 @@ IP::IP(const uint8_t* buffer, uint32_t total_sz) { else if (opt_type == END) { // If the end option found, we're done if (TINS_UNLIKELY(stream.pointer() != options_end)) { - // Make sure we found the END option at the end of the options list - throw malformed_packet(); + // Skip to the end of the options list + stream.skip(options_end -stream.pointer()); } break; } From 63d4d0e24100a1078168434dd6b16a9d9fe1f502 Mon Sep 17 00:00:00 2001 From: yagel-dev <1234yagel@gmail.com> Date: Wed, 9 Oct 2024 17:18:35 +0300 Subject: [PATCH 2/2] Fix formatting --- src/ip.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ip.cpp b/src/ip.cpp index 3e764cf3..8d494058 100644 --- a/src/ip.cpp +++ b/src/ip.cpp @@ -112,7 +112,7 @@ IP::IP(const uint8_t* buffer, uint32_t total_sz) { // If the end option found, we're done if (TINS_UNLIKELY(stream.pointer() != options_end)) { // Skip to the end of the options list - stream.skip(options_end -stream.pointer()); + stream.skip(options_end - stream.pointer()); } break; }