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

sync: release 0.16.x #1816

Merged
merged 4 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
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
16 changes: 12 additions & 4 deletions userspace/libscap/engine/savefile/scap_savefile.c
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,12 @@ static int32_t scap_read_proclist(scap_reader_t* r, uint32_t block_length, uint3
readsize = r->read(r, tinfo.args, stlen);
CHECK_READ_SIZE_ERR(readsize, stlen, error);

// the string is not null-terminated on file
tinfo.args[stlen] = 0;
// the string is sometimes not null-terminated on file
if(stlen > 0 && tinfo.args[stlen - 1] != '\0')
{
tinfo.args[stlen] = '\0';
stlen++;
}
tinfo.args_len = stlen;

subreadsize += readsize;
Expand Down Expand Up @@ -478,8 +482,12 @@ static int32_t scap_read_proclist(scap_reader_t* r, uint32_t block_length, uint3
readsize = r->read(r, tinfo.env, stlen);
CHECK_READ_SIZE_ERR(readsize, stlen, error);

// the string is not null-terminated on file
tinfo.env[stlen] = 0;
// the string is sometimes not null-terminated on file
if(stlen > 0 && tinfo.env[stlen - 1] != '\0')
{
tinfo.env[stlen] = '\0';
stlen++;
}
tinfo.env_len = stlen;

subreadsize += readsize;
Expand Down
5 changes: 5 additions & 0 deletions userspace/libsinsp/parsers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5125,6 +5125,11 @@ void sinsp_parser::parse_container_json_evt(sinsp_evt *evt)
container_info->set_lookup_status(sinsp_container_lookup::state::FAILED);
}
}
else
{
// Fallback at successful state
container_info->set_lookup_status(sinsp_container_lookup::state::SUCCESSFUL);
}

const Json::Value& created_time = container["created_time"];
if(check_int64_json_is_convertible(created_time, "created_time"))
Expand Down
14 changes: 7 additions & 7 deletions userspace/libsinsp/threadinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -523,9 +523,9 @@ void sinsp_threadinfo::set_user(uint32_t uid)

if (m_inspector->is_user_details_enabled())
{
m_user.set_name(user->name, sizeof(user->name));
m_user.set_homedir(user->homedir, sizeof(user->homedir));
m_user.set_shell(user->shell, sizeof(user->shell));
m_user.set_name(user->name, strnlen(user->name, MAX_CREDENTIALS_STR_LEN));
m_user.set_homedir(user->homedir, strnlen(user->homedir, MAX_CREDENTIALS_STR_LEN));
m_user.set_shell(user->shell, strnlen(user->shell, MAX_CREDENTIALS_STR_LEN));
}
}
else
Expand All @@ -551,7 +551,7 @@ void sinsp_threadinfo::set_group(uint32_t gid)

if (m_inspector->is_user_details_enabled())
{
m_group.set_name(group->name, sizeof(group->name));
m_group.set_name(group->name, strnlen(group->name, MAX_CREDENTIALS_STR_LEN));
}
}
else
Expand All @@ -574,9 +574,9 @@ void sinsp_threadinfo::set_loginuser(uint32_t loginuid)

if (m_inspector->is_user_details_enabled())
{
m_loginuser.set_name(login_user->name, sizeof(login_user->name));
m_loginuser.set_homedir(login_user->homedir, sizeof(login_user->homedir));
m_loginuser.set_shell(login_user->shell, sizeof(login_user->shell));
m_loginuser.set_name(login_user->name, strnlen(login_user->name, MAX_CREDENTIALS_STR_LEN));
m_loginuser.set_homedir(login_user->homedir, strnlen(login_user->homedir, MAX_CREDENTIALS_STR_LEN));
m_loginuser.set_shell(login_user->shell, strnlen(login_user->shell, MAX_CREDENTIALS_STR_LEN));
}
}
else
Expand Down
Loading