mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-13 13:26:01 +03:00
Merge pull request #3426 from wooffie/fix-rx-476
fix: rx operators better null checks
This commit is contained in:
commit
f2170d8576
@ -68,19 +68,20 @@ bool Rx::evaluate(Transaction *transaction, RuleWithActions *rule,
|
|||||||
|
|
||||||
// FIXME: DRY regex error reporting. This logic is currently duplicated in other operators.
|
// FIXME: DRY regex error reporting. This logic is currently duplicated in other operators.
|
||||||
if (regex_result != Utils::RegexResult::Ok) {
|
if (regex_result != Utils::RegexResult::Ok) {
|
||||||
transaction->m_variableMscPcreError.set("1", transaction->m_variableOffset);
|
if (transaction) {
|
||||||
|
transaction->m_variableMscPcreError.set("1", transaction->m_variableOffset);
|
||||||
|
|
||||||
std::string regex_error_str = "OTHER";
|
std::string regex_error_str = "OTHER";
|
||||||
if (regex_result == Utils::RegexResult::ErrorMatchLimit) {
|
if (regex_result == Utils::RegexResult::ErrorMatchLimit) {
|
||||||
regex_error_str = "MATCH_LIMIT";
|
regex_error_str = "MATCH_LIMIT";
|
||||||
transaction->m_variableMscPcreLimitsExceeded.set("1", transaction->m_variableOffset);
|
transaction->m_variableMscPcreLimitsExceeded.set("1", transaction->m_variableOffset);
|
||||||
transaction->m_collections.m_tx_collection->storeOrUpdateFirst("MSC_PCRE_LIMITS_EXCEEDED", "1");
|
transaction->m_collections.m_tx_collection->storeOrUpdateFirst("MSC_PCRE_LIMITS_EXCEEDED", "1");
|
||||||
ms_dbg_a(transaction, 7, "Set TX.MSC_PCRE_LIMITS_EXCEEDED to 1");
|
ms_dbg_a(transaction, 7, "Set TX.MSC_PCRE_LIMITS_EXCEEDED to 1");
|
||||||
|
}
|
||||||
|
|
||||||
|
ms_dbg_a(transaction, 1, "rx: regex error '" + regex_error_str + "' for pattern '" + re->pattern + "'");
|
||||||
}
|
}
|
||||||
|
|
||||||
ms_dbg_a(transaction, 1, "rx: regex error '" + regex_error_str + "' for pattern '" + re->pattern + "'");
|
|
||||||
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,18 +62,20 @@ bool RxGlobal::evaluate(Transaction *transaction, RuleWithActions *rule,
|
|||||||
|
|
||||||
// FIXME: DRY regex error reporting. This logic is currently duplicated in other operators.
|
// FIXME: DRY regex error reporting. This logic is currently duplicated in other operators.
|
||||||
if (regex_result != Utils::RegexResult::Ok) {
|
if (regex_result != Utils::RegexResult::Ok) {
|
||||||
transaction->m_variableMscPcreError.set("1", transaction->m_variableOffset);
|
if (transaction) {
|
||||||
|
transaction->m_variableMscPcreError.set("1", transaction->m_variableOffset);
|
||||||
|
|
||||||
std::string regex_error_str = "OTHER";
|
std::string regex_error_str = "OTHER";
|
||||||
if (regex_result == Utils::RegexResult::ErrorMatchLimit) {
|
if (regex_result == Utils::RegexResult::ErrorMatchLimit) {
|
||||||
regex_error_str = "MATCH_LIMIT";
|
regex_error_str = "MATCH_LIMIT";
|
||||||
transaction->m_variableMscPcreLimitsExceeded.set("1", transaction->m_variableOffset);
|
transaction->m_variableMscPcreLimitsExceeded.set("1", transaction->m_variableOffset);
|
||||||
transaction->m_collections.m_tx_collection->storeOrUpdateFirst("MSC_PCRE_LIMITS_EXCEEDED", "1");
|
transaction->m_collections.m_tx_collection->storeOrUpdateFirst("MSC_PCRE_LIMITS_EXCEEDED", "1");
|
||||||
ms_dbg_a(transaction, 7, "Set TX.MSC_PCRE_LIMITS_EXCEEDED to 1");
|
ms_dbg_a(transaction, 7, "Set TX.MSC_PCRE_LIMITS_EXCEEDED to 1");
|
||||||
|
}
|
||||||
|
|
||||||
|
ms_dbg_a(transaction, 1, "rxGlobal: regex error '" + regex_error_str + "' for pattern '" + re->pattern + "'");
|
||||||
}
|
}
|
||||||
|
|
||||||
ms_dbg_a(transaction, 1, "rxGlobal: regex error '" + regex_error_str + "' for pattern '" + re->pattern + "'");
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user