diff --git a/headers/modsecurity/rule.h b/headers/modsecurity/rule.h index 454a0cf0..01035de0 100644 --- a/headers/modsecurity/rule.h +++ b/headers/modsecurity/rule.h @@ -72,7 +72,7 @@ class Rule { std::shared_ptr *value, Transaction *trans, std::list, - std::shared_ptr>> *ret, + std::weak_ptr>> *ret, std::string *path, int *nth); @@ -84,7 +84,7 @@ class Rule { bool containsDisruptive, std::shared_ptr ruleMessage); std::list, - std::shared_ptr>> executeDefaultTransformations( + std::weak_ptr>> executeDefaultTransformations( Transaction *trasn, const std::string &value); bool executeOperatorAt(Transaction *trasn, std::string key, @@ -106,7 +106,7 @@ class Rule { std::shared_ptr value, Transaction *trans, std::list, - std::shared_ptr>> *ret, + std::weak_ptr>> *ret, std::shared_ptr transStr, int nth); diff --git a/src/rule.cc b/src/rule.cc index 1a8f0d65..152343bc 100644 --- a/src/rule.cc +++ b/src/rule.cc @@ -330,7 +330,7 @@ inline void Rule::executeTransformation(actions::Action *a, std::shared_ptr *value, Transaction *trans, std::list, - std::shared_ptr>> *ret, + std::weak_ptr>> *ret, std::string *path, int *nth) { @@ -338,7 +338,7 @@ inline void Rule::executeTransformation(actions::Action *a, std::string newValue = a->evaluate(*oldValue, trans); if (newValue != *oldValue) { - std::shared_ptr u(new std::string(newValue)); + std::shared_ptr u(&newValue); if (m_containsMultiMatchAction) { ret->push_back(std::make_pair(u, a->m_name)); (*nth)++; @@ -360,14 +360,14 @@ inline void Rule::executeTransformation(actions::Action *a, std::list, - std::shared_ptr>> + std::weak_ptr>> Rule::executeDefaultTransformations( Transaction *trans, const std::string &in) { int none = 0; int transformations = 0; std::string path(""); std::list, - std::shared_ptr>> ret; + std::weak_ptr>> ret; std::shared_ptr value = std::shared_ptr(new std::string(in)); @@ -716,7 +716,7 @@ bool Rule::evaluate(Transaction *trans, } std::list, - std::shared_ptr>> values; + std::weak_ptr>> values; values = executeDefaultTransformations(trans, value);