mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-29 19:24:29 +03:00
Adds support to replaceNulls transformation
This commit is contained in:
@@ -37,14 +37,18 @@ ReplaceNulls::ReplaceNulls(std::string action)
|
||||
|
||||
std::string ReplaceNulls::evaluate(std::string value,
|
||||
Assay *assay) {
|
||||
/**
|
||||
* @todo Implement the transformation ReplaceNulls
|
||||
*/
|
||||
if (assay) {
|
||||
#ifndef NO_LOGS
|
||||
assay->debug(4, "Transformation ReplaceNulls is not implemented yet.");
|
||||
#endif
|
||||
int64_t i;
|
||||
|
||||
i = 0;
|
||||
while (i < value.size()) {
|
||||
if (value.at(i) == '\0') {
|
||||
value.erase(i, 1);
|
||||
value.insert(i, " ", 1);
|
||||
} else {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
|
@@ -99,7 +99,7 @@ Transformation* Transformation::instantiate(std::string a) {
|
||||
IF_MATCH(remove_whitespace) { return new RemoveWhitespace(a); }
|
||||
IF_MATCH(compressWhitespace) { return new CompressWhitespace(a); }
|
||||
IF_MATCH(replaceComments) { return new ReplaceComments(a); }
|
||||
IF_MATCH(replace_nulls) { return new ReplaceNulls(a); }
|
||||
IF_MATCH(replaceNulls) { return new ReplaceNulls(a); }
|
||||
IF_MATCH(sha1) { return new Sha1(a); }
|
||||
IF_MATCH(sql_hex_decode) { return new SqlHexDecode(a); }
|
||||
IF_MATCH(transformation) { return new Transformation(a); }
|
||||
|
Reference in New Issue
Block a user