Adds first PoC for the operator offset feature

This commit is contained in:
Felipe Zimmerle
2017-01-19 14:34:48 -03:00
committed by Felipe Zimmerle
parent 9a8fc3116a
commit ecbf292f6d
89 changed files with 2908 additions and 105 deletions

View File

@@ -24,15 +24,21 @@ namespace modsecurity {
namespace operators {
bool Within::evaluate(Transaction *transaction, const std::string &str) {
bool Within::evaluate(Transaction *transaction, Rule *rule,
const std::string &str, RuleMessage *ruleMessage) {
bool res = false;
std::string paramTarget = MacroExpansion::expand(m_param, transaction);
size_t pos = 0;
if (str.empty()) {
return true;
}
res = paramTarget.find(str) != std::string::npos;
pos = paramTarget.find(str);
res = pos != std::string::npos;
if (res) {
logOffset(ruleMessage, pos, str.size());
}
return res;
}