mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-29 19:24:29 +03:00
Avoids string copy by working with pointers while resolving variables
This commit is contained in:
@@ -33,11 +33,20 @@ namespace collection {
|
||||
|
||||
class Variable {
|
||||
public:
|
||||
Variable(const std::string& key, const std::string& value) :
|
||||
Variable(const std::string *key, const std::string *value) :
|
||||
m_key(key),
|
||||
m_value(value) { }
|
||||
std::string m_key;
|
||||
std::string m_value;
|
||||
m_value(value),
|
||||
m_dynamic_value(false) { }
|
||||
|
||||
~Variable() {
|
||||
if (m_dynamic_value) {
|
||||
delete m_value;
|
||||
}
|
||||
}
|
||||
|
||||
const std::string *m_key;
|
||||
const std::string *m_value;
|
||||
bool m_dynamic_value;
|
||||
};
|
||||
|
||||
} // namespace collection
|
||||
|
@@ -56,7 +56,7 @@ class Rule {
|
||||
void executeActionsAfterFullMatch(Transaction *trasn,
|
||||
bool containsDisruptive, RuleMessage *ruleMessage);
|
||||
std::vector<std::string> executeSecDefaultActionTransofrmations(
|
||||
Transaction *trasn, std::string &value, bool multiMatch);
|
||||
Transaction *trasn, const std::string &value, bool multiMatch);
|
||||
bool executeOperatorAt(Transaction *trasn, std::string key,
|
||||
std::string value);
|
||||
void executeActionsIndependentOfChainedRuleResult(Transaction *trasn,
|
||||
|
@@ -361,6 +361,19 @@ class Transaction {
|
||||
RequestBodyProcessor::XML *m_xml;
|
||||
RequestBodyProcessor::JSON *m_json;
|
||||
|
||||
std::string m_variableDuration;
|
||||
std::map<std::string, std::string> m_variableEnvs;
|
||||
std::string m_variableHighestSeverityAction;
|
||||
std::string m_variableRemoteUser;
|
||||
std::string m_variableTime;
|
||||
std::string m_variableTimeDay;
|
||||
std::string m_variableTimeEpoch;
|
||||
std::string m_variableTimeHour;
|
||||
std::string m_variableTimeMin;
|
||||
std::string m_variableTimeSec;
|
||||
std::string m_variableTimeWDay;
|
||||
std::string m_variableTimeYear;
|
||||
|
||||
private:
|
||||
std::string *m_ARGScombinedSizeStr;
|
||||
std::string *m_namesArgs;
|
||||
|
Reference in New Issue
Block a user