]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Pull request #3870: detection: Handle case when no rule tree node is found for a...
authorSteve Chew (stechew) <stechew@cisco.com>
Wed, 7 Jun 2023 04:33:44 +0000 (04:33 +0000)
committerSteve Chew (stechew) <stechew@cisco.com>
Wed, 7 Jun 2023 04:33:44 +0000 (04:33 +0000)
Merge in SNORT/snort3 from ~STECHEW/snort3:detection_fix to master

Squashed commit of the following:

commit fcfd02235de65ead825b0892946c8f960104e4d6
Author: Steve Chew <stechew@cisco.com>
Date:   Tue Jun 6 23:20:28 2023 -0400

    detection: Handle case when no rule tree node is found for a policy ID.

src/detection/fp_detect.cc

index 4886bac493e5f9366246377de9917e1067934b3e..6b4b00e8ba5d5b34bb961200121c14b03716627b 100644 (file)
@@ -274,12 +274,17 @@ int fpLogEvent(const RuleTreeNode* rtn, const OptTreeNode* otn, Packet* p)
 **    OptTreeNode        * - the otn to add.
 **
 **  FORMAL OUTPUTS
-**    int - 1 max_events variable hit, 0 successful.
+**    int - 2 No rule tree node found for given policy ID.
+**    int - 1 max_events variable hit.
+**    int - 0 successful.
 **
 */
 int fpAddMatch(OtnxMatchData* omd, const OptTreeNode* otn)
 {
     RuleTreeNode* rtn = getRtnFromOtn(otn);
+    if ( not rtn )
+        return 2;
+
     unsigned evalIndex = rtn->listhead->ruleListNode->evalIndex;
 
     const SnortConfig* sc = SnortConfig::get_conf();