]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
stream: fix stream pruning being too aggressive
authorVictor Julien <vjulien@oisf.net>
Thu, 13 Jan 2022 11:13:43 +0000 (12:13 +0100)
committerShivani Bhardwaj <shivanib134@gmail.com>
Thu, 20 Jan 2022 14:45:04 +0000 (20:15 +0530)
Pruning of StreamBufferBlocks could remove blocks that fell entirely
after the target offset due to a logic error. This could lead to data
being evicted that was still meant to be processed in theapp-layer
parsers.

Bug: #4953.
(cherry picked from commit 78f5e082f5188204606ab9ceb5044447e49aaca2)

src/util-streaming-buffer.c

index 577bc3b635776454948414122453fed7c5db5e74..3e6375c625e6f9ff81e0cdd10d5d9adccc06c35b 100644 (file)
@@ -412,7 +412,7 @@ static void SBBPrune(StreamingBuffer *sb)
     StreamingBufferBlock *sbb = NULL, *safe = NULL;
     RB_FOREACH_SAFE(sbb, SBB, &sb->sbb_tree, safe) {
         /* completely beyond window, we're done */
-        if (sbb->offset > sb->stream_offset) {
+        if (sbb->offset >= sb->stream_offset) {
             sb->head = sbb;
             break;
         }