]> git.ipfire.org Git - thirdparty/suricata.git/commit
util/flow-rate: fix sum calc on index next to base
authorShivani Bhardwaj <shivani@oisf.net>
Thu, 10 Apr 2025 06:36:05 +0000 (12:06 +0530)
committerVictor Julien <victor@inliniac.net>
Fri, 30 May 2025 19:13:47 +0000 (21:13 +0200)
commitbe68a646570d404d4094772362c4b97a1e53f82a
treec49a3e7ab941626eeed2a4f071012ea2d13f10ce
parent4a655053e86d3f68ea0f59945461b05822dfd395
util/flow-rate: fix sum calc on index next to base

When the buffer is wrapped around, for any new index, the calculation
must subtract the previous value stored in the buffer. So far, the code
ended up adding to the existing buffer value on the index unless it was
the first index after wrapping around. This is incorrect and would end
up flagging a flow as elephant a lot before than it should be.

Harden the Test06 by checking for such a case.

Bug 7694
src/util-flow-rate.c