mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-11-19 10:44:25 +03:00
Adds checks for the NO_LOGS definition and improved the vars resolution time
This commit is contained in:
@@ -125,45 +125,55 @@ bool ValidateUtf8Encoding::evaluate(Assay *assay, const std::string &str) {
|
||||
switch (rc) {
|
||||
case UNICODE_ERROR_CHARACTERS_MISSING :
|
||||
if (assay) {
|
||||
#ifndef NO_LOGS
|
||||
assay->debug(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 (assay) {
|
||||
#ifndef NO_LOGS
|
||||
assay->debug(8, "Invalid UTF-8 encoding: "
|
||||
"invalid byte value in character "
|
||||
"at " + str + ". [offset \"" +
|
||||
std::to_string(i) + "\"]");
|
||||
#endif
|
||||
}
|
||||
return true;
|
||||
break;
|
||||
case UNICODE_ERROR_OVERLONG_CHARACTER :
|
||||
if (assay) {
|
||||
#ifndef NO_LOGS
|
||||
assay->debug(8, "Invalid UTF-8 encoding: "
|
||||
"overlong character detected "
|
||||
"at " + str + ". [offset \"" +
|
||||
std::to_string(i) + "\"]");
|
||||
#endif
|
||||
}
|
||||
return true;
|
||||
break;
|
||||
case UNICODE_ERROR_RESTRICTED_CHARACTER :
|
||||
if (assay) {
|
||||
#ifndef NO_LOGS
|
||||
assay->debug(8, "Invalid UTF-8 encoding: "
|
||||
"use of restricted character "
|
||||
"at " + str + ". [offset \"" +
|
||||
std::to_string(i) + "\"]");
|
||||
#endif
|
||||
}
|
||||
return true;
|
||||
break;
|
||||
case UNICODE_ERROR_DECODING_ERROR :
|
||||
if (assay) {
|
||||
#ifndef NO_LOGS
|
||||
assay->debug(8, "Error validating UTF-8 decoding "
|
||||
"at " + str + ". [offset \"" +
|
||||
std::to_string(i) + "\"]");
|
||||
#endif
|
||||
}
|
||||
return true;
|
||||
break;
|
||||
@@ -171,9 +181,11 @@ bool ValidateUtf8Encoding::evaluate(Assay *assay, const std::string &str) {
|
||||
|
||||
if (rc <= 0) {
|
||||
if (assay) {
|
||||
#ifndef NO_LOGS
|
||||
assay->debug(8, "Internal error during UTF-8 validation "
|
||||
"at " + str + ". [offset \"" +
|
||||
std::to_string(i) + "\"]");
|
||||
#endif
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user