perf trace: Fix off by one string allocation problem

We need to consider the null terminator, oops, fix it.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Fixes: 017037ff ("perf trace: Allow specifying list of syscalls and events in -e/--expr/--event")
Link: http://lkml.kernel.org/n/tip-j79jpqqe91gvxqmsgxgfn2ni@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent c73881ee
...@@ -2806,7 +2806,7 @@ static int trace__parse_events_option(const struct option *opt, const char *str, ...@@ -2806,7 +2806,7 @@ static int trace__parse_events_option(const struct option *opt, const char *str,
struct trace *trace = (struct trace *)opt->value; struct trace *trace = (struct trace *)opt->value;
const char *s = str; const char *s = str;
char *sep = NULL, *lists[2] = { NULL, NULL, }; char *sep = NULL, *lists[2] = { NULL, NULL, };
int len = strlen(str), err = -1, list; int len = strlen(str) + 1, err = -1, list;
char *strace_groups_dir = system_path(STRACE_GROUPS_DIR); char *strace_groups_dir = system_path(STRACE_GROUPS_DIR);
char group_name[PATH_MAX]; char group_name[PATH_MAX];
......
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