mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-29 11:16:33 +03:00
parser: Fix the expanded list inclusion
This commit is contained in:
@@ -402,7 +402,9 @@ VAR_FREE_TEXT_SPACE_COMMA [^, \t\"]+
|
||||
driver.error (*driver.loc.back(), "", file + std::string(": Not able to open file."));
|
||||
throw p::syntax_error(*driver.loc.back(), "");
|
||||
}
|
||||
for (auto& s: modsecurity::utils::expandEnv(fi, 0)) {
|
||||
std::list<std::string> files = modsecurity::utils::expandEnv(fi, 0);
|
||||
files.reverse();
|
||||
for (auto& s: files) {
|
||||
std::string f = modsecurity::utils::find_resource(s, driver.ref.back());
|
||||
yyin = fopen(f.c_str(), "r" );
|
||||
if (!yyin) {
|
||||
@@ -426,7 +428,9 @@ VAR_FREE_TEXT_SPACE_COMMA [^, \t\"]+
|
||||
driver.error (*driver.loc.back(), "", file + std::string(": Not able to open file."));
|
||||
throw p::syntax_error(*driver.loc.back(), "");
|
||||
}
|
||||
for (auto& s: modsecurity::utils::expandEnv(fi, 0)) {
|
||||
std::list<std::string> files = modsecurity::utils::expandEnv(fi, 0);
|
||||
files.reverse();
|
||||
for (auto& s: files) {
|
||||
std::string f = modsecurity::utils::find_resource(s, driver.ref.back());
|
||||
yyin = fopen(f.c_str(), "r" );
|
||||
if (!yyin) {
|
||||
@@ -437,7 +441,6 @@ VAR_FREE_TEXT_SPACE_COMMA [^, \t\"]+
|
||||
driver.ref.push_back(f.c_str());
|
||||
driver.loc.push_back(new yy::location());
|
||||
yypush_buffer_state(yy_create_buffer( yyin, YY_BUF_SIZE ));
|
||||
|
||||
}
|
||||
free(f);
|
||||
}
|
||||
|
@@ -106,8 +106,8 @@ std::string get_path(const std::string& file) {
|
||||
}
|
||||
|
||||
|
||||
std::vector<std::string> expandEnv(const std::string& var, int flags) {
|
||||
std::vector<std::string> vars;
|
||||
std::list<std::string> expandEnv(const std::string& var, int flags) {
|
||||
std::list<std::string> vars;
|
||||
|
||||
wordexp_t p;
|
||||
if (wordexp(var.c_str(), &p, flags) == false) {
|
||||
|
@@ -16,7 +16,7 @@
|
||||
#include <ctime>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <list>
|
||||
|
||||
#include "modsecurity/modsecurity.h"
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace utils {
|
||||
double cpu_seconds(void);
|
||||
std::string find_resource(const std::string& file, const std::string& param);
|
||||
std::string get_path(const std::string& file);
|
||||
std::vector<std::string> expandEnv(const std::string& var, int flags);
|
||||
std::list<std::string> expandEnv(const std::string& var, int flags);
|
||||
void createDir(std::string dir, int mode);
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user