Refactoring: Makes transformations to work with new execute signature

This commit is contained in:
Felipe Zimmerle
2019-02-26 15:39:27 -03:00
parent 3c0c4a8ba0
commit 7640f7b40b
93 changed files with 913 additions and 715 deletions

View File

@@ -33,26 +33,24 @@ namespace actions {
namespace transformations {
std::string HtmlEntityDecode::execute(const std::string &value,
Transaction *transaction) {
std::string ret;
void HtmlEntityDecode::execute(Transaction *t,
ModSecStackString &in,
ModSecStackString &out) {
unsigned char *input;
input = reinterpret_cast<unsigned char *>
(malloc(sizeof(char) * value.length()+1));
(malloc(sizeof(char) * in.length()+1));
if (input == NULL) {
return "";
return;
}
memcpy(input, value.c_str(), value.length()+1);
memcpy(input, in.c_str(), in.length()+1);
size_t i = inplace(input, value.length());
size_t i = inplace(input, in.length());
ret.assign(reinterpret_cast<char *>(input), i);
out.assign(reinterpret_cast<char *>(input), i);
free(input);
return ret;
}