mirror of https://github.com/OISF/suricata
output/alert: fix alert index access for verdict
The engine uses p.alerts.cnt as an index to access the packet alert that has the `pass` action for the verdict. For IDS/IPS mode, a `pass` will always be the last signature in the alert queue. However, that position could be either `p.alerts.cnt` or `p.alerts.cnt-1`, depending on whether the `pass` rule has the `alert` keyword or not. This patch fix corner-case scenarios of: - accessing an index out of boundaries - off-by-one access Without changing how the engine increments the alerts.cnt, as this is used in many places, and would be a more invasive change. It checks the two different scenarios, plus the case when there is only a single match as a silent `pass` rule. Bug #8021 Bug #7630pull/14289/head
parent
efe7aeb145
commit
482e5eac92
Loading…
Reference in New Issue