public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kernel/trace/trace_functions_graph.c: fix nsecs_str buffer size
@ 2009-03-23 16:10 Daniel Mack
  2009-03-23 16:40 ` Frederic Weisbecker
  2009-03-23 16:42 ` [tip:tracing/ftrace] " Daniel Mack
  0 siblings, 2 replies; 6+ messages in thread
From: Daniel Mack @ 2009-03-23 16:10 UTC (permalink / raw)
  To: linux-kernel; +Cc: Daniel Mack

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>
---
 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 930c08e..7533b25 100644
--- a/kernel/trace/trace_functions_graph.c
+++ b/kernel/trace/trace_functions_graph.c
@@ -281,7 +281,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;
 
-- 
1.6.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-03-23 17:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-23 16:10 [PATCH] kernel/trace/trace_functions_graph.c: fix nsecs_str buffer size Daniel Mack
2009-03-23 16:40 ` Frederic Weisbecker
2009-03-23 16:57   ` Daniel Mack
2009-03-23 16:42 ` [tip:tracing/ftrace] " Daniel Mack
2009-03-23 16:47   ` Frederic Weisbecker
2009-03-23 17:15     ` Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox