Commit 137a5258 authored by Ian Rogers's avatar Ian Rogers Committed by Arnaldo Carvalho de Melo

perf traceevent: Ensure read cmdlines are null terminated.

Issue detected by address sanitizer.

Fixes: cd4ceb63 ("perf util: Save pid-cmdline mapping into tracing header")
Signed-off-by: default avatarIan Rogers <irogers@google.com>
Acked-by: default avatarNamhyung 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.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 394e4306
...@@ -361,6 +361,7 @@ static int read_saved_cmdline(struct tep_handle *pevent) ...@@ -361,6 +361,7 @@ static int read_saved_cmdline(struct tep_handle *pevent)
pr_debug("error reading saved cmdlines\n"); pr_debug("error reading saved cmdlines\n");
goto out; goto out;
} }
buf[ret] = '\0';
parse_saved_cmdline(pevent, buf, size); parse_saved_cmdline(pevent, buf, size);
ret = 0; ret = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment