Skip to content

Commit 137a525

Browse files
captain5050acmel
authored andcommitted
perf traceevent: Ensure read cmdlines are null terminated.
Issue detected by address sanitizer. Fixes: cd4ceb6 ("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>
1 parent 394e430 commit 137a525

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

tools/perf/util/trace-event-read.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,7 @@ static int read_saved_cmdline(struct tep_handle *pevent)
361361
pr_debug("error reading saved cmdlines\n");
362362
goto out;
363363
}
364+
buf[ret] = '\0';
364365

365366
parse_saved_cmdline(pevent, buf, size);
366367
ret = 0;

0 commit comments

Comments
 (0)