From ff920472f64092a6819b9bbe9e95ab268e90d226 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Fri, 22 Feb 2019 16:14:48 +0100 Subject: [PATCH] stream-buffer: fix block search compare func Sbb search function could return the wrong block due to an off by one error. --- src/util-streaming-buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util-streaming-buffer.c b/src/util-streaming-buffer.c index 1c6e131db1..a3c04c4656 100644 --- a/src/util-streaming-buffer.c +++ b/src/util-streaming-buffer.c @@ -68,7 +68,7 @@ int SBBCompare(struct StreamingBufferBlock *a, struct StreamingBufferBlock *b) static inline int InclusiveCompare(StreamingBufferBlock *lookup, StreamingBufferBlock *intree) { const uint64_t lre = lookup->offset + lookup->len; const uint64_t tre = intree->offset + intree->len; - if (lre < intree->offset) // entirely before + if (lre <= intree->offset) // entirely before return -1; else if (lre >= intree->offset && lre <= tre) // (some) overlap return 0;