Skip to content

Commit

Permalink
fix(libsinsp): Add a couple of NULL checks
Browse files Browse the repository at this point in the history
Signed-off-by: Gerald Combs <[email protected]>
  • Loading branch information
geraldcombs authored and poiana committed Oct 6, 2023
1 parent c042300 commit 0b57876
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
5 changes: 5 additions & 0 deletions userspace/libsinsp/filterchecks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,11 @@ uint8_t* sinsp_filter_check_fspath::extract(sinsp_evt* evt, OUT uint32_t* len, b
{
sinsp_threadinfo* tinfo = evt->get_thread_info();

if(tinfo == NULL)
{
return NULL;
}

std::filesystem::path tstr = tinfo->get_cwd() + m_tstr;
m_tstr = std::filesystem::absolute(tstr).lexically_normal().string();
}
Expand Down
10 changes: 9 additions & 1 deletion userspace/libsinsp/parsers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2807,7 +2807,15 @@ void sinsp_parser::parse_dirfd(sinsp_evt *evt, char* name, int64_t dirfd, OUT st
}
else if(dirfd == PPM_AT_FDCWD)
{
*sdir = evt->m_tinfo->get_cwd();
if(evt->m_tinfo != NULL)
{
*sdir = evt->m_tinfo->get_cwd();
}
else
{
ASSERT(false);
*sdir = "<UNKNOWN>";
}
}
else
{
Expand Down

0 comments on commit 0b57876

Please sign in to comment.