]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect/rule: Use de_ctx buffer id
authorJeff Lucovsky <jlucovsky@oisf.net>
Thu, 14 Sep 2023 14:30:13 +0000 (10:30 -0400)
committerVictor Julien <victor@inliniac.net>
Fri, 15 Sep 2023 15:09:00 +0000 (17:09 +0200)
This commit uses the detect engine buffer id instead of the global
value.

Issue: 5211

src/detect-engine-build.c

index aa12ab56a8a84fba33b08151bd857051a433daf5..80f5d89757e1bd2b972610c6423436c16fe58a81 100644 (file)
@@ -640,7 +640,7 @@ static json_t *RulesGroupPrintSghStats(const DetectEngineCtx *de_ctx, const SigG
     uint32_t mpms_min = 0;
     uint32_t mpms_max = 0;
 
-    int max_buffer_type_id = DetectBufferTypeMaxId() + 1;
+    int max_buffer_type_id = de_ctx->buffer_type_id;
 
     struct {
         uint32_t total;
@@ -755,6 +755,7 @@ static json_t *RulesGroupPrintSghStats(const DetectEngineCtx *de_ctx, const SigG
             if (w > mpms_max)
                 mpms_max = w;
 
+            BUG_ON(mpm_list >= max_buffer_type_id);
             mpm_stats[mpm_list].total += w;
             mpm_stats[mpm_list].cnt++;
             if (mpm_stats[mpm_list].min == 0 || w < mpm_stats[mpm_list].min)