Skip to content

Commit

Permalink
fix(userspace/libsinsp): fixed possible UB in compute_program_hash() …
Browse files Browse the repository at this point in the history
…method.

Signed-off-by: Federico Di Pierro <[email protected]>
  • Loading branch information
FedeDP authored and poiana committed Sep 4, 2024
1 parent 741104b commit 36c79e3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion userspace/libsinsp/threadinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,8 @@ void sinsp_threadinfo::compute_program_hash()
//
if(m_comm.size() == 4)
{
uint32_t ncomm = *(uint32_t*)m_comm.c_str();
uint32_t ncomm;
memcpy(&ncomm, m_comm.c_str(), 4);

if(ncomm == STR_AS_NUM_JAVA || ncomm == STR_AS_NUM_RUBY ||
ncomm == STR_AS_NUM_PERL || ncomm == STR_AS_NUM_NODE)
Expand Down

0 comments on commit 36c79e3

Please sign in to comment.