libtraceevent: Fix uninitialized variable in eval_num_arg()
PATCH 1/1 libtraceevent: Fix uninitialized variable in eval_num_arg()
From: "Steven Rostedt (Google)" <[email protected]>
It appears that my compiler version did not notice that "field_size" passed to check_data_offset_size() in the TEP_PRINT_DYNAMIC_ARRAY case was not initialized. But other compilers do.
Since this case we just want to make sure the offset is not passed the end of the event data, we can simply pass in zero.
--- src/event-parse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
src/event-parse.c +1 -1
@@ -4310,7 +4310,7 @@ eval_num_arg(void *data, int size, struct tep_event *event, struct tep_print_argdynamic_offset_field (tep, arg->dynarray.field, data, size, &offset,NULL );if (check_data_offset_size (event, arg->field.name, size, - offset, field_size)) { + offset,0 )) { val = (unsigned long )data;break ; }
Signature · 1 line
2.35.1
Quoted 6 lines · Steven Rostedt
From: "Steven Rostedt (Google)" <[email protected]>
It appears that my compiler version did not notice that "
field_size" passed tocheck_data_offset_size()in theTEP_PRINT_DYNAMIC_ARRAYcase was not initialized. But other compilers do.
Quoted 6 lines
Since this case we just want to make sure the offset is not passed the end of the event data, we can simply pass in zero.
Fixes efd32896dd5db ("libtraceevent: Add warnings if fields are outside the event")Reported-by Ross Zwisler <[email protected]>Signed-off-by Steven Rostedt (Google) <[email protected]>