]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
defrag: fix off by one
authorPhilippe Antoine <pantoine@oisf.net>
Mon, 15 Jul 2024 07:52:00 +0000 (09:52 +0200)
committerVictor Julien <vjulien@oisf.net>
Fri, 27 Sep 2024 08:34:21 +0000 (10:34 +0200)
Ticket: 7067

This off by one could lead to an empty fragment being inserted
in the rb tree, which led to integer underflow

(cherry picked from commit 9203656496c4081260817cce018a0d8fd57869b5)

src/defrag.c

index c5979b285d1b2246f4ba403fb7d708baea974f21..86d6101728d79ba1b13934b18da92d0692fe0194 100644 (file)
@@ -852,7 +852,7 @@ DefragInsertFrag(ThreadVars *tv, DecodeThreadVars *dtv, DefragTracker *tracker,
         }
     }
 
-    if (ltrim > data_len) {
+    if (ltrim >= data_len) {
         /* Full packet has been trimmed due to the overlap policy. Overlap
          * already set. */
         goto done;