From: Adrian Mamolea (admamole) Date: Fri, 9 Feb 2024 08:51:52 +0000 (+0000) Subject: Pull request #4187: detection: copy ip var name in dup_rtn X-Git-Tag: 3.1.81.0~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c08c3ef0ba622d2ca1add3f32fb45cc62313698b;p=thirdparty%2Fsnort3.git Pull request #4187: detection: copy ip var name in dup_rtn Merge in SNORT/snort3 from ~ADMAMOLE/snort3:var_bug to master Squashed commit of the following: commit c3b9334700647d5bbd1698da377117f64e50228d Author: Adrian Mamolea Date: Tue Jan 30 09:22:38 2024 -0500 detection: copy ip var name in dup_rtn --- diff --git a/src/detection/rules.cc b/src/detection/rules.cc index af7772d9d..f64bebb27 100644 --- a/src/detection/rules.cc +++ b/src/detection/rules.cc @@ -123,9 +123,15 @@ RuleTreeNode* RuleStateMap::dup_rtn(RuleTreeNode* rtn, IpsPolicy* policy) ret->sip = sip ? sfvar_create_alias(sip, sip->name) : sfvar_deep_copy(rtn->sip); + if (!sip and rtn->sip->name) + ret->sip->name = snort_strdup(rtn->sip->name); + ret->dip = dip ? sfvar_create_alias(dip, dip->name) : sfvar_deep_copy(rtn->dip); + if (!dip and rtn->dip->name) + ret->dip->name = snort_strdup(rtn->dip->name); + ret->src_portobject = spo ? spo : ret->src_portobject; ret->dst_portobject = dpo ? dpo : ret->dst_portobject; ret->otnRefCount = 0;