mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-29 19:24:29 +03:00
Add DebugLog message for bad pattern in rx operator
This commit is contained in:
@@ -52,6 +52,10 @@ bool Rx::evaluate(Transaction *transaction, RuleWithActions *rule,
|
||||
}
|
||||
|
||||
std::vector<Utils::SMatchCapture> captures;
|
||||
if (re->hasError()) {
|
||||
ms_dbg_a(transaction, 3, "Error with regular expression: \"" + re->pattern + "\"");
|
||||
return false;
|
||||
}
|
||||
re->searchOneMatch(input, captures);
|
||||
|
||||
if (rule && rule->hasCaptureAction() && transaction) {
|
||||
|
@@ -75,6 +75,9 @@ Regex::Regex(const std::string& pattern_, bool ignoreCase)
|
||||
pcre2_options, &errornumber, &erroroffset, NULL);
|
||||
if (m_pc != NULL) {
|
||||
m_match_data = pcre2_match_data_create_from_pattern(m_pc, NULL);
|
||||
if (m_match_data == NULL) {
|
||||
m_pc = NULL;
|
||||
}
|
||||
}
|
||||
#else
|
||||
const char *errptr = NULL;
|
||||
|
@@ -72,6 +72,9 @@ class Regex {
|
||||
Regex(const Regex&) = delete;
|
||||
Regex& operator=(const Regex&) = delete;
|
||||
|
||||
bool hasError() const {
|
||||
return (m_pc == NULL);
|
||||
}
|
||||
std::list<SMatch> searchAll(const std::string& s) const;
|
||||
bool searchOneMatch(const std::string& s, std::vector<SMatchCapture>& captures) const;
|
||||
bool searchGlobal(const std::string& s, std::vector<SMatchCapture>& captures) const;
|
||||
|
Reference in New Issue
Block a user