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.
Signed-off-by: Robert Richter <robert.richter@amd.com>
bool force, bool repipe,
struct perf_tool *tool)
{
- size_t len = filename ? strlen(filename) + 1 : 0;
+ size_t len = filename ? strlen(filename) : 0;
struct perf_session *self = zalloc(sizeof(*self) + len);
if (self == NULL)
int cwdlen;
char *cwd;
struct ordered_samples ordered_samples;
- char filename[0];
+ char filename[1];
};
struct perf_tool;