aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/annotate.c
diff options
context:
space:
mode:
authorIan Rogers <[email protected]>2019-10-26 03:56:44 +0000
committerArnaldo Carvalho de Melo <[email protected]>2019-11-07 11:30:18 +0000
commit5c65b1c0842f9daddc6aec4bdb4b5d898006be19 (patch)
tree5a2de128a1859ed7d05f983c1c96043323e8970c /tools/perf/util/annotate.c
parentperf machine: Add kernel_dso() method (diff)
downloadkernel-5c65b1c0842f9daddc6aec4bdb4b5d898006be19.tar.gz
kernel-5c65b1c0842f9daddc6aec4bdb4b5d898006be19.zip
perf annotate: Fix heap overflow
Fix expand_tabs that copies the source lines '\0' and then appends another '\0' at a potentially out of bounds address. Signed-off-by: Ian Rogers <[email protected]> Acked-by: Jiri Olsa <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Jin Yao <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Song Liu <[email protected]> Cc: Stephane Eranian <[email protected]> Link: http://lore.kernel.org/lkml/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
Diffstat (limited to 'tools/perf/util/annotate.c')
-rw-r--r--tools/perf/util/annotate.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index ef1866a902c4..bee0fee122f8 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -1892,7 +1892,7 @@ static char *expand_tabs(char *line, char **storage, size_t *storage_len)
}
/* Expand the last region. */
- len = line_len + 1 - src;
+ len = line_len - src;
memcpy(&new_line[dst], &line[src], len);
dst += len;
new_line[dst] = '\0';