mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-10-03 21:13:50 +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,
|
std::string ReplaceNulls::evaluate(std::string value,
|
||||||
Assay *assay) {
|
Assay *assay) {
|
||||||
/**
|
int64_t i;
|
||||||
* @todo Implement the transformation ReplaceNulls
|
|
||||||
*/
|
i = 0;
|
||||||
if (assay) {
|
while (i < value.size()) {
|
||||||
#ifndef NO_LOGS
|
if (value.at(i) == '\0') {
|
||||||
assay->debug(4, "Transformation ReplaceNulls is not implemented yet.");
|
value.erase(i, 1);
|
||||||
#endif
|
value.insert(i, " ", 1);
|
||||||
|
} else {
|
||||||
|
i++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -99,7 +99,7 @@ Transformation* Transformation::instantiate(std::string a) {
|
|||||||
IF_MATCH(remove_whitespace) { return new RemoveWhitespace(a); }
|
IF_MATCH(remove_whitespace) { return new RemoveWhitespace(a); }
|
||||||
IF_MATCH(compressWhitespace) { return new CompressWhitespace(a); }
|
IF_MATCH(compressWhitespace) { return new CompressWhitespace(a); }
|
||||||
IF_MATCH(replaceComments) { return new ReplaceComments(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(sha1) { return new Sha1(a); }
|
||||||
IF_MATCH(sql_hex_decode) { return new SqlHexDecode(a); }
|
IF_MATCH(sql_hex_decode) { return new SqlHexDecode(a); }
|
||||||
IF_MATCH(transformation) { return new Transformation(a); }
|
IF_MATCH(transformation) { return new Transformation(a); }
|
||||||
|
Reference in New Issue
Block a user