lkml.org 
[lkml]   [2009]   [Mar]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[tip:tracing/ftrace] kernel/trace/trace_functions_graph.c: fix nsecs_str buffer size
Commit-ID:  603b9b9081ae0a1af986b9059a0a5055876ddea9
Gitweb: http://git.kernel.org/tip/603b9b9081ae0a1af986b9059a0a5055876ddea9
Author: Daniel Mack <daniel@caiaq.de>
AuthorDate: Mon, 23 Mar 2009 17:10:37 +0100
Committer: Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 23 Mar 2009 17:40:51 +0100

kernel/trace/trace_functions_graph.c: fix nsecs_str buffer size

Impact: fix currently inactive buffer-overflow

In kernel/trace/trace_functions_graph.c, print_graph_duration(),
len can be as low as 1 or 2, which could make snprintf() write
beyond the buffer bounds. (Found by cppcheck, no real-world bug
occured)

Signed-off-by: Daniel Mack <daniel@caiaq.de>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <1237824637-28190-1-git-send-email-daniel@caiaq.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
kernel/trace/trace_functions_graph.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c
index e876816..a305472 100644
--- a/kernel/trace/trace_functions_graph.c
+++ b/kernel/trace/trace_functions_graph.c
@@ -430,7 +430,7 @@ print_graph_duration(unsigned long long duration, struct trace_seq *s)
unsigned long nsecs_rem = do_div(duration, 1000);
/* log10(ULONG_MAX) + '\0' */
char msecs_str[21];
- char nsecs_str[5];
+ char nsecs_str[8];
int ret, len;
int i;


\
 
 \ /
  Last update: 2009-03-23 17:47    [W:0.135 / U:0.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site