]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect: fix match array reset
authorVictor Julien <victor@inliniac.net>
Mon, 18 Mar 2019 09:34:03 +0000 (10:34 +0100)
committerVictor Julien <victor@inliniac.net>
Mon, 18 Mar 2019 12:02:55 +0000 (13:02 +0100)
Fix match array reset depending on prefilter matches for the
current run. If there were none, the match array of the previous
packet was used. This could lead to inspection of rules from the
wrong rule group.

src/detect.c

index c83d318dbffa8ced5bf57b0c7f83a9173838ba0f..427e7f87d2c3872f56c788f607dc151f47106be5 100644 (file)
@@ -237,7 +237,6 @@ static inline void DetectPrefilterMergeSort(DetectEngineCtx *de_ctx,
                                             DetectEngineThreadCtx *det_ctx)
 {
     SigIntId mpm, nonmpm;
-    det_ctx->match_array_cnt = 0;
     SigIntId *mpm_ptr = det_ctx->pmq.rule_id_array;
     SigIntId *nonmpm_ptr = det_ctx->non_pf_id_array;
     uint32_t m_cnt = det_ctx->pmq.rule_id_array_cnt;
@@ -922,6 +921,7 @@ static DetectRunScratchpad DetectRunSetup(
     det_ctx->filestore_cnt = 0;
     det_ctx->base64_decoded_len = 0;
     det_ctx->raw_stream_progress = 0;
+    det_ctx->match_array_cnt = 0;
 
 #ifdef DEBUG
     if (p->flags & PKT_STREAM_ADD) {