Skip to content

Commit

Permalink
fix(userspace/engine): avoid storing escaped strings in engine defs
Browse files Browse the repository at this point in the history
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
  • Loading branch information
jasondellaluce authored and poiana committed Jan 23, 2024
1 parent 2f7582e commit 8b5aab9
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions userspace/engine/rule_loader_compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ static bool resolve_list(std::string& cnd, const falco_list& list)
{
static std::string blanks = " \t\n\r";
static std::string delims = blanks + "(),=";
std::string tmp;
std::string new_cnd;
size_t start, end;
bool used = false;
Expand Down Expand Up @@ -212,7 +213,9 @@ static bool resolve_list(std::string& cnd, const falco_list& list)
{
sub += ", ";
}
sub += v;
tmp = v;
quote_item(tmp);
sub += tmp;
}
// if substituted list is empty, we need to
// remove a comma from the left or the right
Expand Down Expand Up @@ -339,7 +342,6 @@ void rule_loader::compiler::compile_list_infos(
const collector& col,
indexed_vector<falco_list>& out) const
{
std::string tmp;
std::list<std::string> used;
falco_list v;
for (const auto &list : col.lists())
Expand All @@ -352,17 +354,14 @@ void rule_loader::compiler::compile_list_infos(
if (ref && ref->index < list.visibility)
{
used.push_back(ref->name);
for (auto val : ref->items)
for (const auto &val : ref->items)
{
quote_item(val);
v.items.push_back(val);
}
}
else
{
tmp = item;
quote_item(tmp);
v.items.push_back(tmp);
v.items.push_back(item);
}
}
v.used = false;
Expand Down

0 comments on commit 8b5aab9

Please sign in to comment.