mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-10-01 03:57:47 +03:00
Adds first PoC for the operator offset feature
This commit is contained in:
committed by
Felipe Zimmerle
parent
9a8fc3116a
commit
ecbf292f6d
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user