mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-11-18 18:30:35 +03:00
Changes debuglogs schema to avoid unecessary str allocation
This commit is contained in:
@@ -126,58 +126,48 @@ bool ValidateUtf8Encoding::evaluate(Transaction *transaction, Rule *rule,
|
||||
switch (rc) {
|
||||
case UNICODE_ERROR_CHARACTERS_MISSING :
|
||||
if (transaction) {
|
||||
#ifndef NO_LOGS
|
||||
transaction->debug(8, "Invalid UTF-8 encoding: "
|
||||
ms_dbg_a(transaction, 8, "Invalid UTF-8 encoding: "
|
||||
"not enough bytes in character "
|
||||
"at " + str + ". [offset \"" +
|
||||
std::to_string(i) + "\"]");
|
||||
#endif
|
||||
}
|
||||
return true;
|
||||
break;
|
||||
case UNICODE_ERROR_INVALID_ENCODING :
|
||||
if (transaction) {
|
||||
#ifndef NO_LOGS
|
||||
transaction->debug(8, "Invalid UTF-8 encoding: "
|
||||
ms_dbg_a(transaction, 8, "Invalid UTF-8 encoding: "
|
||||
"invalid byte value in character "
|
||||
"at " + str + ". [offset \"" +
|
||||
std::to_string(i) + "\"]");
|
||||
#endif
|
||||
logOffset(ruleMessage, i, str.size());
|
||||
}
|
||||
return true;
|
||||
break;
|
||||
case UNICODE_ERROR_OVERLONG_CHARACTER :
|
||||
if (transaction) {
|
||||
#ifndef NO_LOGS
|
||||
transaction->debug(8, "Invalid UTF-8 encoding: "
|
||||
ms_dbg_a(transaction, 8, "Invalid UTF-8 encoding: "
|
||||
"overlong character detected "
|
||||
"at " + str + ". [offset \"" +
|
||||
std::to_string(i) + "\"]");
|
||||
#endif
|
||||
logOffset(ruleMessage, i, str.size());
|
||||
}
|
||||
return true;
|
||||
break;
|
||||
case UNICODE_ERROR_RESTRICTED_CHARACTER :
|
||||
if (transaction) {
|
||||
#ifndef NO_LOGS
|
||||
transaction->debug(8, "Invalid UTF-8 encoding: "
|
||||
ms_dbg_a(transaction, 8, "Invalid UTF-8 encoding: "
|
||||
"use of restricted character "
|
||||
"at " + str + ". [offset \"" +
|
||||
std::to_string(i) + "\"]");
|
||||
#endif
|
||||
logOffset(ruleMessage, i, str.size());
|
||||
}
|
||||
return true;
|
||||
break;
|
||||
case UNICODE_ERROR_DECODING_ERROR :
|
||||
if (transaction) {
|
||||
#ifndef NO_LOGS
|
||||
transaction->debug(8, "Error validating UTF-8 decoding "
|
||||
ms_dbg_a(transaction, 8, "Error validating UTF-8 decoding "
|
||||
"at " + str + ". [offset \"" +
|
||||
std::to_string(i) + "\"]");
|
||||
#endif
|
||||
logOffset(ruleMessage, i, str.size());
|
||||
}
|
||||
return true;
|
||||
@@ -186,11 +176,9 @@ bool ValidateUtf8Encoding::evaluate(Transaction *transaction, Rule *rule,
|
||||
|
||||
if (rc <= 0) {
|
||||
if (transaction) {
|
||||
#ifndef NO_LOGS
|
||||
transaction->debug(8, "Internal error during UTF-8 validation "
|
||||
ms_dbg_a(transaction, 8, "Internal error during UTF-8 validation "
|
||||
"at " + str + ". [offset \"" +
|
||||
std::to_string(i) + "\"]");
|
||||
#endif
|
||||
logOffset(ruleMessage, i, str.size());
|
||||
}
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user