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

fix(include/falcosecurity): fix table access #22

Merged
merged 1 commit into from
Jul 17, 2023
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
22 changes: 18 additions & 4 deletions include/falcosecurity/table.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,24 @@ using table_entry = _internal::ss_plugin_table_field_t*;

class table_stale_entry
{
public:
FALCOSECURITY_INLINE
table_stale_entry(table_stale_entry&&) = default;
table_stale_entry(table_stale_entry&& o)
{
m_entry = o.m_entry;
m_table = o.m_table;
m_writer = o.m_writer;
o.m_entry = nullptr;
};
FALCOSECURITY_INLINE
table_stale_entry& operator=(table_stale_entry&&) = default;
table_stale_entry& operator=(table_stale_entry&& o)
{
m_entry = o.m_entry;
m_table = o.m_table;
m_writer = o.m_writer;
o.m_entry = nullptr;
return *this;
};
FALCOSECURITY_INLINE
table_stale_entry(const table_stale_entry&) = delete;
FALCOSECURITY_INLINE
Expand Down Expand Up @@ -483,7 +497,7 @@ class table
}
throw plugin_exception(msg);
}
return std::move(table_stale_entry(res, m_table, w));
return table_stale_entry(res, m_table, w);
}

template<typename T>
Expand All @@ -492,7 +506,7 @@ class table
table_stale_entry&& e)
{
check_type(key);
_internal::read_state_data<T>(m_data, key);
_internal::write_state_data<T>(m_data, key);
auto res = static_cast<table_entry>(
w.m_writer->add_table_entry(m_table, &m_data, e.m_entry));
if(!res)
Expand Down