Skip to content

Commit

Permalink
fix: dangling pointer and mixed-signedness warning
Browse files Browse the repository at this point in the history
Signed-off-by: Federico Aponte <[email protected]>
  • Loading branch information
federico-sysdig authored and poiana committed Jan 7, 2025
1 parent d1881b4 commit 63f9cfb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions test/drivers/event_class/event_class.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1399,13 +1399,13 @@ void event_test::assert_ipv4_string(const char* desired_ipv4, int starting_index

void event_test::assert_port_string(const char* desired_port, int starting_index, direction dir) {
uint16_t port = *(uint16_t*)(m_event_params[m_current_param].valptr + starting_index);
const char* port_string = std::to_string(port).c_str();
auto port_string = std::to_string(port);

if(dir == DEST) {
ASSERT_STREQ(port_string, desired_port)
ASSERT_STREQ(port_string.c_str(), desired_port)
<< VALUE_NOT_CORRECT << m_current_param << "(dest port)" << std::endl;
} else {
ASSERT_STREQ(port_string, desired_port)
ASSERT_STREQ(port_string.c_str(), desired_port)
<< VALUE_NOT_CORRECT << m_current_param << "(source port)" << std::endl;
}
}
Expand Down
2 changes: 1 addition & 1 deletion userspace/libscap/engine/savefile/converter/converter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ static conversion_result convert_event(scap_evt *new_evt,
scap_evt *tmp_evt = NULL;

// We iterate over the instructions
for(int i = 0; i < ci.m_instrs.size(); i++, param_to_populate++) {
for(size_t i = 0; i < ci.m_instrs.size(); i++, param_to_populate++) {
PRINT_MESSAGE("Instruction n° %d. Param to populate: %d\n", i, param_to_populate);

switch(ci.m_instrs[i].flags) {
Expand Down

0 comments on commit 63f9cfb

Please sign in to comment.