diff options
| author | Ian Rogers <irogers@google.com> | 2021-02-26 14:14:31 -0800 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-03-17 16:43:44 +0100 |
| commit | 6b687917f0ce3ba9fcb68f029d942e365a867aac (patch) | |
| tree | be3c7bab7fddd32fe117af72f65b1a9e0d24ffc5 /tools | |
| parent | 07c50b7976c2fbcaded80f01393d19a0a23d71aa (diff) | |
| download | linux-6b687917f0ce3ba9fcb68f029d942e365a867aac.tar.gz linux-6b687917f0ce3ba9fcb68f029d942e365a867aac.tar.bz2 linux-6b687917f0ce3ba9fcb68f029d942e365a867aac.zip | |
perf traceevent: Ensure read cmdlines are null terminated.
commit 137a5258939aca56558f3a23eb229b9c4b293917 upstream.
Issue detected by address sanitizer.
Fixes: cd4ceb63438e9e28 ("perf util: Save pid-cmdline mapping into tracing header")
Signed-off-by: Ian Rogers <irogers@google.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lore.kernel.org/lkml/20210226221431.1985458-1-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/perf/util/trace-event-read.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/tools/perf/util/trace-event-read.c b/tools/perf/util/trace-event-read.c index 5eb1b2469bba..12324325ea0b 100644 --- a/tools/perf/util/trace-event-read.c +++ b/tools/perf/util/trace-event-read.c @@ -381,6 +381,7 @@ static int read_saved_cmdline(struct tep_handle *pevent) pr_debug("error reading saved cmdlines\n"); goto out; } + buf[ret] = '\0'; parse_saved_cmdline(pevent, buf, size); ret = 0; |
