Skip to content

Commit

Permalink
Check getsockopt event before accessing it (#1284)
Browse files Browse the repository at this point in the history
* Ensure to parse only the new getsockopt event

* Fix missed evt nparams check
  • Loading branch information
mattpag authored Dec 21, 2018
1 parent 9722dbc commit 7516832
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions userspace/libsinsp/parsers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,10 @@ void sinsp_parser::process_event(sinsp_evt *evt)
parse_setsid_exit(evt);
break;
case PPME_SOCKET_GETSOCKOPT_X:
parse_getsockopt_exit(evt);
if(evt->get_num_params() > 0)
{
parse_getsockopt_exit(evt);
}
break;
default:
break;
Expand Down Expand Up @@ -680,7 +683,7 @@ bool sinsp_parser::reset(sinsp_evt *evt)
//
// Error detection logic
//
if(evt->m_info->nparams != 0 &&
if(evt->get_num_params() != 0 &&
((evt->m_info->params[0].name[0] == 'r' &&
evt->m_info->params[0].name[1] == 'e' &&
evt->m_info->params[0].name[2] == 's' &&
Expand Down

0 comments on commit 7516832

Please sign in to comment.