Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid going past end of ruleset/etag arrays #468

Merged
merged 1 commit into from
Nov 16, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions userspace/engine/ruleset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,11 @@ bool falco_ruleset::run(gen_event *evt, uint32_t etag, uint16_t ruleset)

void falco_ruleset::event_tags_for_ruleset(vector<bool> &evttypes, uint16_t ruleset)
{
if(m_rulesets.size() < (size_t) ruleset + 1)
{
return;
}

return m_rulesets[ruleset]->event_tags_for_ruleset(evttypes);
}

Expand Down Expand Up @@ -314,7 +319,7 @@ void falco_sinsp_ruleset::evttypes_for_ruleset(vector<bool> &evttypes, uint16_t
{
uint32_t etag = evttype_to_event_tag(etype);

if(event_tags[etag])
if(etag < event_tags.size() && event_tags[etag])
{
evttypes[etype] = true;
}
Expand All @@ -333,7 +338,7 @@ void falco_sinsp_ruleset::syscalls_for_ruleset(vector<bool> &syscalls, uint16_t
{
uint32_t etag = evttype_to_event_tag(syscallid);

if(event_tags[etag])
if(etag < event_tags.size() && event_tags[etag])
{
syscalls[syscallid] = true;
}
Expand Down