⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content

Make sure table_entry is initialized when calling read_value #62

@irozzo-1A

Description

@irozzo-1A

Describe the bug

Calling read_value on an uninitialized table_entry ends up with nil pointer dereference here or here.
Users are supposed to make sure get_entry is called before read_value, but there is no null check and nothing forbids it in the API.

e.g.

⚠️ the thread entry hasn't been initialized, it will segfault

falcosecurity::table_entry thread_entry;
 thread_entry = m_threads_table.get_entry(tr, thread_id);
 m_container_id_field.read_value(tr, thread_entry, container_id);

✅ the thread_entry has been initialized with get_entry

falcosecurity::table_entry thread_entry;
 thread_entry = m_threads_table.get_entry(tr, thread_id);
 m_container_id_field.read_value(tr, thread_entry, container_id);

How to reproduce it

falcosecurity/plugins#1112 (comment)

Expected behaviour

The SDK protects from misusage that produces undefined behaviours.

Screenshots

Environment

<N/A>

Additional context

falcosecurity/plugins#1076

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions