mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-15 23:55:03 +03:00
Perform ReplaceNulls transformation in-place
This commit is contained in:
parent
1505025990
commit
da775eca81
@ -23,21 +23,16 @@ ReplaceNulls::ReplaceNulls(const std::string &action)
|
|||||||
this->action_kind = 1;
|
this->action_kind = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ReplaceNulls::transform(std::string &val, const Transaction *trans) const {
|
bool ReplaceNulls::transform(std::string &value, const Transaction *trans) const {
|
||||||
int64_t i;
|
bool changed = false;
|
||||||
std::string value(val);
|
|
||||||
|
|
||||||
i = 0;
|
for(auto &c : value) {
|
||||||
while (i < value.size()) {
|
if (c == '\0') {
|
||||||
if (value.at(i) == '\0') {
|
c = ' ';
|
||||||
value[i] = ' ';
|
changed = true;
|
||||||
} else {
|
|
||||||
i++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto changed = val != value;
|
|
||||||
val = value;
|
|
||||||
return changed;
|
return changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user