From: Steve Chew (stechew) Date: Wed, 7 Jun 2023 04:33:44 +0000 (+0000) Subject: Pull request #3870: detection: Handle case when no rule tree node is found for a... X-Git-Tag: 3.1.64.0~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0db79551ad40319a8ea2237fc8ba49071b3e7a3c;p=thirdparty%2Fsnort3.git Pull request #3870: detection: Handle case when no rule tree node is found for a policy ID. Merge in SNORT/snort3 from ~STECHEW/snort3:detection_fix to master Squashed commit of the following: commit fcfd02235de65ead825b0892946c8f960104e4d6 Author: Steve Chew Date: Tue Jun 6 23:20:28 2023 -0400 detection: Handle case when no rule tree node is found for a policy ID. --- diff --git a/src/detection/fp_detect.cc b/src/detection/fp_detect.cc index 4886bac49..6b4b00e8b 100644 --- a/src/detection/fp_detect.cc +++ b/src/detection/fp_detect.cc @@ -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();