perf tools: Fix out-of-bound access to struct perf_session

If filename is NULL there is an out-of-bound access to struct
perf_session if it would be used with perf_session__open(). Shouldn't
actually happen in current implementation as filename is always !NULL.
Fixing this by always null-terminating filename.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1323248577-11268-3-git-send-email-robert.richter@amd.com
Signed-off-by: Robert Richter <robert.richter@amd.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Robert Richter
2011-12-07 10:02:52 +01:00
committed by Arnaldo Carvalho de Melo
parent f7a8a13364
commit 002c4fd92d
2 changed files with 2 additions and 2 deletions

View File

@@ -50,7 +50,7 @@ struct perf_session {
int cwdlen;
char *cwd;
struct ordered_samples ordered_samples;
char filename[0];
char filename[1];
};
struct perf_tool;