mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-11-16 17:41:52 +03:00
Makes operator to use string_view
This commit is contained in:
@@ -110,8 +110,10 @@ bool VerifyCPF::verify(const char *cpfnumber, int len) {
|
||||
}
|
||||
|
||||
|
||||
bool VerifyCPF::evaluate(Transaction *t, RuleWithActions *rule,
|
||||
const std::string& input, RuleMessage *ruleMessage) {
|
||||
bool VerifyCPF::evaluate(Transaction *transaction,
|
||||
RuleWithActions *rule,
|
||||
const bpstd::string_view &input,
|
||||
RuleMessage *ruleMessage) {
|
||||
std::list<SMatch> matches;
|
||||
bool is_cpf = false;
|
||||
int i;
|
||||
@@ -121,15 +123,15 @@ bool VerifyCPF::evaluate(Transaction *t, RuleWithActions *rule,
|
||||
}
|
||||
|
||||
for (i = 0; i < input.size() - 1 && is_cpf == false; i++) {
|
||||
matches = m_re->searchAll(input.substr(i, input.size()));
|
||||
matches = m_re->searchAll(input.substr(i, input.size()).to_string());
|
||||
for (const auto & m : matches) {
|
||||
is_cpf = verify(m.str().c_str(), m.str().size());
|
||||
if (is_cpf) {
|
||||
logOffset(ruleMessage, m.offset(), m.str().size());
|
||||
if (rule && t && rule->hasCaptureAction()) {
|
||||
t->m_collections.m_tx_collection->storeOrUpdateFirst(
|
||||
if (rule && transaction && rule->hasCaptureAction()) {
|
||||
transaction->m_collections.m_tx_collection->storeOrUpdateFirst(
|
||||
"0", m.str());
|
||||
ms_dbg_a(t, 7, "Added VerifyCPF match TX.0: " + \
|
||||
ms_dbg_a(transaction, 7, "Added VerifyCPF match TX.0: " + \
|
||||
m.str());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user