aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Carpenter <error27@gmail.com>2010-03-15 08:28:00 -0400
committerJason Wessel <jason.wessel@windriver.com>2011-03-25 17:37:30 -0400
commitadb4b83c12f9d966ea3478aa14c60511467c9916 (patch)
treeb9dd2efee119cc6f053ffa6fb50a3d336e5e3dfb
parent521cb40b0c44418a4fd36dc633f575813d59a43d (diff)
kgdboc,kgdbts: strlen() doesn't count the terminator
This is an off by one because strlen() doesn't count the null terminator. We strcpy() these strings into an array of size MAX_CONFIG_LEN. Signed-off-by: Dan Carpenter <error27@gmail.com> Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
-rw-r--r--drivers/misc/kgdbts.c2
-rw-r--r--drivers/tty/serial/kgdboc.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/drivers/misc/kgdbts.c b/drivers/misc/kgdbts.c
index 59c118c19a91..27dc463097f3 100644
--- a/drivers/misc/kgdbts.c
+++ b/drivers/misc/kgdbts.c
@@ -988,7 +988,7 @@ static void kgdbts_run_tests(void)
988 988
989static int kgdbts_option_setup(char *opt) 989static int kgdbts_option_setup(char *opt)
990{ 990{
991 if (strlen(opt) > MAX_CONFIG_LEN) { 991 if (strlen(opt) >= MAX_CONFIG_LEN) {
992 printk(KERN_ERR "kgdbts: config string too long\n"); 992 printk(KERN_ERR "kgdbts: config string too long\n");
993 return -ENOSPC; 993 return -ENOSPC;
994 } 994 }
diff --git a/drivers/tty/serial/kgdboc.c b/drivers/tty/serial/kgdboc.c
index 25a8bc565f40..87e7e6c876d4 100644
--- a/drivers/tty/serial/kgdboc.c
+++ b/drivers/tty/serial/kgdboc.c
@@ -131,7 +131,7 @@ static void kgdboc_unregister_kbd(void)
131 131
132static int kgdboc_option_setup(char *opt) 132static int kgdboc_option_setup(char *opt)
133{ 133{
134 if (strlen(opt) > MAX_CONFIG_LEN) { 134 if (strlen(opt) >= MAX_CONFIG_LEN) {
135 printk(KERN_ERR "kgdboc: config string too long\n"); 135 printk(KERN_ERR "kgdboc: config string too long\n");
136 return -ENOSPC; 136 return -ENOSPC;
137 } 137 }