]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect/alert: directly increment alerts.discarded
authorJuliana Fajardini <jufajardini@gmail.com>
Mon, 9 May 2022 14:24:18 +0000 (11:24 -0300)
committerVictor Julien <vjulien@oisf.net>
Sat, 21 May 2022 04:51:48 +0000 (06:51 +0200)
In the unlikely case of AlertQueueExpand failure, we were incrementing
the discarded alerts stats in AlertQueueAppend via the Packet member in the
DetectEngineThreadCtx, which may not be initialized yet.

Bug #5353

src/detect-engine-alert.c

index 98fe24c2dcc5ef8fbd37674ec239c71e0da8a917..359c224de9d41e830afc6e68645a26ad37ff97e4 100644 (file)
@@ -268,7 +268,7 @@ void AlertQueueAppend(DetectEngineThreadCtx *det_ctx, const Signature *s, Packet
         /* we must grow the alert queue */
         if (pos == AlertQueueExpand(det_ctx)) {
             /* this means we failed to expand the queue */
-            det_ctx->p->alerts.discarded++;
+            p->alerts.discarded++;
             return;
         }
     }