Test case skeleton for #1941

This commit is contained in:
Felipe Zimmerle
2018-10-27 01:29:03 -03:00
parent 662fe63a47
commit 3f0ea90970
8 changed files with 2805 additions and 2696 deletions

View File

@@ -1735,11 +1735,38 @@ expression:
char *ucode = NULL, *hmap = NULL;
int processing = 0;
std::string file = modsecurity::utils::find_resource($1,
std::vector<std::string> param = utils::string::ssplit($1, ' ');
if (param.size() <= 1) {
std::stringstream ss;
ss << "Failed to process unicode map, missing parameter: " << $1 << " ";
ss << err;
driver.error(@0, ss.str());
YYERROR;
}
int num = 0;
try {
num = std::stod(param.back());
} catch (...) {
std::stringstream ss;
ss << "Failed to process unicode map, last parameter is expected to be a number: " << param.back() << " ";
ss << err;
driver.error(@0, ss.str());
YYERROR;
}
param.pop_back();
std::string f;
while (param.size() > 0) {
f = param.back() + " " + f;
param.pop_back();
}
std::string file = modsecurity::utils::find_resource(f,
driver.ref.back(), &err);
if (file.empty()) {
std::stringstream ss;
ss << "Failed to load locate the unicode map file from: " << $1 << " ";
ss << "Failed to locate the unicode map file from: " << f << " ";
ss << err;
driver.error(@0, ss.str());
YYERROR;