mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-11-16 01:22:18 +03:00
Remove unnecessary heap-allocation & copy in Transaction::extractArguments
- utils::urldecode_nonstrict_inplace decodes inplace so key & value, which are values returned by utils::string::ssplit_pair can be just be modified and do not need to be copied. - Updated signature of utils::urldecode_nonstrict_inplace, as its two callers already have std::string values.
This commit is contained in:
@@ -27,16 +27,8 @@ UrlDecode::UrlDecode(const std::string &action)
|
||||
}
|
||||
|
||||
bool UrlDecode::transform(std::string &value, const Transaction *trans) const {
|
||||
int invalid_count = 0;
|
||||
int changed;
|
||||
const auto new_len = utils::urldecode_nonstrict_inplace(
|
||||
(unsigned char*)value.data(),
|
||||
value.length(),
|
||||
&invalid_count,
|
||||
&changed);
|
||||
|
||||
value.resize(new_len);
|
||||
return changed != 0;
|
||||
int invalid_count;
|
||||
return utils::urldecode_nonstrict_inplace(value, invalid_count);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user