aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/tools
diff options
context:
space:
mode:
authorIan Rogers <irogers@google.com>2021-02-26 14:14:31 -0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-03-17 17:03:37 +0100
commit4d0273ab0a796cd1a3b888f47e53a6a75171bd8e (patch)
treeb851613a81a9bd651936aeb9fcf45dd2f654ff68 /tools
parentselftests: forwarding: Fix race condition in mirror installation (diff)
downloadwireguard-linux-4d0273ab0a796cd1a3b888f47e53a6a75171bd8e.tar.xz
wireguard-linux-4d0273ab0a796cd1a3b888f47e53a6a75171bd8e.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.c1
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 8593d3c200c6..0116b0c06e97 100644
--- a/tools/perf/util/trace-event-read.c
+++ b/tools/perf/util/trace-event-read.c
@@ -361,6 +361,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;