]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Merge pull request #2860 in SNORT/snort3 from ~DKYRYLOV/snort3:dump_rule_signature_fi...
authorMike Stepanek (mstepane) <mstepane@cisco.com>
Tue, 27 Apr 2021 10:12:26 +0000 (10:12 +0000)
committerMike Stepanek (mstepane) <mstepane@cisco.com>
Tue, 27 Apr 2021 10:12:26 +0000 (10:12 +0000)
Squashed commit of the following:

commit ac143943fff79eb95f80d84c05416f0c13c4d18b
Author: dkyrylov <dkyrylov@cisco.com>
Date:   Tue Apr 20 13:49:46 2021 +0300

    parser: Remove rule merge in dump mode

src/parser/parse_rule.cc

index 6f9c03b532f2aad16414dd947031508bc67aa60e..31decae3c7d5c02a79a9abedd461a8374ad1b319 100644 (file)
@@ -775,23 +775,26 @@ static void SetupRTNFuncList(RuleTreeNode* rtn)
 }
 
 // if it doesn't match any of the existing nodes, make a new node and
-// stick it at the end of the list
+// stick it at the end of the list. Write every rtn in dump mode
+// to retain uninitialized variables.
 static RuleTreeNode* ProcessHeadNode(SnortConfig* sc, RuleTreeNode* test_node)
 {
-    RuleTreeNode* rtn = findHeadNode(
-        sc, test_node, get_ips_policy()->policy_id);
-
-    if ( rtn )
-        FreeRuleTreeNode(test_node);
-
-    else
+    RuleTreeNode* rtn;
+    if ( !sc->dump_rule_info() )
     {
-        head_count++;
-        rtn = new RuleTreeNode;
-        XferHeader(test_node, rtn);
-        SetupRTNFuncList(rtn);
-    }
+         rtn = findHeadNode(
+            sc, test_node, get_ips_policy()->policy_id);
 
+        if ( rtn )
+        {
+            FreeRuleTreeNode(test_node);
+            return rtn;
+        }
+    }
+    head_count++;
+    rtn = new RuleTreeNode;
+    XferHeader(test_node, rtn);
+    SetupRTNFuncList(rtn);
     return rtn;
 }