From: Arnaldo Carvalho de Melo Date: Thu, 17 Aug 2017 18:12:55 +0000 (-0300) Subject: perf trace: Fix off by one string allocation problem X-Git-Tag: microblaze-4.14-rc3~176^2~16^2~10 X-Git-Url: http://git.monstr.eu/?a=commitdiff_plain;h=d6d4fc6fefda26a88eb99d30e87a8834c59c144a;p=linux-2.6-microblaze.git perf trace: Fix off by one string allocation problem We need to consider the null terminator, oops, fix it. Cc: Adrian Hunter Cc: David Ahern Cc: Jiri Olsa Cc: Namhyung Kim Cc: Wang Nan Fixes: 017037ff3d0b ("perf trace: Allow specifying list of syscalls and events in -e/--expr/--event") Link: http://lkml.kernel.org/n/tip-j79jpqqe91gvxqmsgxgfn2ni@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index de02413a25d3..91905839e386 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c @@ -2806,7 +2806,7 @@ static int trace__parse_events_option(const struct option *opt, const char *str, struct trace *trace = (struct trace *)opt->value; const char *s = str; 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 group_name[PATH_MAX];