[<prev] [next>] [day] [month] [year] [list]
Message-ID: <4E9AA5E1.90001@intra2net.com>
Date: Sun, 16 Oct 2011 11:37:37 +0200
From: Thomas Jarosch <thomas.jarosch@...ra2net.com>
To: Ingo Molnar <mingo@...hat.com>
CC: linux-kernel@...r.kernel.org
Subject: [trace PATCH] Fix unterminated buffer if the length of str exceeds
MAX_TRACER_SIZE
strncpy() doesn't always zero terminate the string.
Detected by "cppcheck"
Signed-off-by: Thomas Jarosch <thomas.jarosch@...ra2net.com>
---
kernel/trace/trace.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index e5df02c..9637b1e 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -126,7 +126,8 @@ static char *default_bootup_tracer;
static int __init set_cmdline_ftrace(char *str)
{
- strncpy(bootup_tracer_buf, str, MAX_TRACER_SIZE);
+ strncpy(bootup_tracer_buf, str, MAX_TRACER_SIZE-1);
+ bootup_tracer_buf[MAX_TRACER_SIZE-1] = '\0';
default_bootup_tracer = bootup_tracer_buf;
/* We are using ftrace early, expand it */
ring_buffer_expanded = 1;
--
1.7.6.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists