[PATCH v3 1/4] libtraceevent: Ensure print_field_raw() terminates with '\0'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Testing printing cpumasks reveals an issue in print_field_raw()'s handling
of arrays: its final operation is trace_seq_putc(']'), which omits a final
'\0'.

The other cases in the function invoke trace_seq_printf() which does the
right thing, only the TEP_FIELD_IS_ARRAY case has that issue. Still, to
prevent any future surprises, add a call to trace_seq_terminate() at the
end of print_field_raw().

Signed-off-by: Valentin Schneider <vschneid@xxxxxxxxxx>
---
 src/event-parse.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/event-parse.c b/src/event-parse.c
index a6e9e93..093b345 100644
--- a/src/event-parse.c
+++ b/src/event-parse.c
@@ -5681,6 +5681,7 @@ static void print_field_raw(struct trace_seq *s, void *data, int size,
 				trace_seq_printf(s, "%llu", val);
 		}
 	}
+	trace_seq_terminate(s);
 }
 
 static int print_parse_data(struct tep_print_parse *parse, struct trace_seq *s,
-- 
2.31.1




[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux