]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect: run buffer setup callback before validate
authorVictor Julien <victor@inliniac.net>
Sun, 5 Nov 2017 21:25:11 +0000 (22:25 +0100)
committerVictor Julien <victor@inliniac.net>
Thu, 23 Nov 2017 17:47:49 +0000 (18:47 +0100)
src/detect-parse.c
src/detect.c

index 03106912824c262e26540bc4fea9f220f14366b2..abf6a8a199c7aaab98d520b03191d3986c9146a6 100644 (file)
@@ -1700,6 +1700,14 @@ static Signature *SigInitHelper(DetectEngineCtx *de_ctx, const char *sigstr,
 
     SigBuildAddressMatchArray(sig);
 
+    /* run buffer type callbacks if any */
+    const int nlists = DetectBufferTypeMaxId();
+    int x;
+    for (x = 0; x < nlists; x++) {
+        if (sig->init_data->smlists[x])
+            DetectBufferRunSetupCallback(x, sig);
+    }
+
     /* validate signature, SigValidate will report the error reason */
     if (SigValidate(de_ctx, sig) == 0) {
         goto error;
index a96362a2d7f7c3bfe56a03ca03f0d335df6052ed..605b2a97f35de9a97b5023bda67eef5b834f3086 100644 (file)
@@ -3034,14 +3034,6 @@ int SigAddressPrepareStage1(DetectEngineCtx *de_ctx)
                 }
             }
         }
-
-        /* run buffer type callbacks if any */
-        int x;
-        for (x = 0; x < nlists; x++) {
-            if (tmp_s->init_data->smlists[x])
-                DetectBufferRunSetupCallback(x, tmp_s);
-        }
-
         de_ctx->sig_cnt++;
     }