aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValentin Schneider <vschneid@redhat.com>2022-12-13 16:56:17 +0000
committerSteven Rostedt (Google) <rostedt@goodmis.org>2022-12-13 19:24:15 -0500
commitb5db86a0405b25a922147bd0dbea58ab059bf11b (patch)
treea19ae6ac4cca49d84cc74440abb6c55cc26369a6
parent74674263c4f1b7b082eac058e3e8d5fd5554dc14 (diff)
downloadlibtraceevent-b5db86a0405b25a922147bd0dbea58ab059bf11b.tar.gz
libtraceevent: Ensure print_field_raw() terminates with '\0'
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(). Link: https://lore.kernel.org/linux-trace-devel/20221213165620.1034287-2-vschneid@redhat.com Cc: Daniel Bristot de Oliveira <bristot@redhat.com> Cc: Clark Williams <williams@redhat.com> Cc: Douglas RAILLARD <douglas.raillard@arm.com> Signed-off-by: Valentin Schneider <vschneid@redhat.com> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
-rw-r--r--src/event-parse.c1
1 files changed, 1 insertions, 0 deletions
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,