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 <[email protected]> Acked-by: Namhyung Kim <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Stephane Eranian <[email protected]> Link: http://lore.kernel.org/lkml/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
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)