Cosmetics: Fix some static analysis report

This commit is contained in:
Felipe Zimmerle
2016-11-29 10:27:51 -03:00
parent 9bd37ccb63
commit e6b58014db
15 changed files with 43 additions and 51 deletions

View File

@@ -49,7 +49,6 @@ std::string MacroExpansion::expand(const std::string& input,
modsecurity::Rule *rule, Transaction *transaction) {
std::string res;
size_t pos = input.find("%{");
std::string v;
if (pos != std::string::npos) {
res = input;
@@ -73,23 +72,6 @@ std::string MacroExpansion::expand(const std::string& input,
std::string var = std::string(variable, collection + 1,
variable.length() - (collection + 1));
/*if (utils::string::toupper(col) == "RULE") {
if (rule == NULL) {
transaction->debug(9, "macro expansion: cannot resolve " \
"RULE variable without the Rule object");
goto ops;
}
modsecurity::Variables::Rule r("RULE:" + var);
std::vector<const collection::Variable *> l;
r.evaluateInternal(transaction, rule, &l);
if (l.size() > 0) {
v = l[0]->m_value;
variableValue = &v;
}
for (auto *i : l) {
delete i;
}
}*/
if (utils::string::toupper(col) == "RULE") {
variableValue = transaction->m_collections.resolveFirst(
"RULE:" + var);
@@ -113,7 +95,7 @@ std::string MacroExpansion::expand(const std::string& input,
if (variableValue != NULL) {
res.insert(start, *variableValue);
}
ops:
pos = res.find("%{");
}