kgdboc,kgdbts: strlen() doesn't count the terminator
authorDan Carpenter <error27@gmail.com>
Mon, 15 Mar 2010 12:28:00 +0000 (07:28 -0500)
committerJason Wessel <jason.wessel@windriver.com>
Fri, 25 Mar 2011 21:37:30 +0000 (16:37 -0500)
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>
drivers/misc/kgdbts.c
drivers/tty/serial/kgdboc.c

index 59c118c19a910e9950a04a069dacf62352a25e9a..27dc463097f37c5e75a3f5859e8f82c65193f81f 100644 (file)
@@ -988,7 +988,7 @@ static void kgdbts_run_tests(void)
 
 static int kgdbts_option_setup(char *opt)
 {
-       if (strlen(opt) > MAX_CONFIG_LEN) {
+       if (strlen(opt) >= MAX_CONFIG_LEN) {
                printk(KERN_ERR "kgdbts: config string too long\n");
                return -ENOSPC;
        }
index 25a8bc565f400b62c155dd31bb39ff08e8d85dd0..87e7e6c876d4b857aacea79feab04bf3c5d04953 100644 (file)
@@ -131,7 +131,7 @@ static void kgdboc_unregister_kbd(void)
 
 static int kgdboc_option_setup(char *opt)
 {
-       if (strlen(opt) > MAX_CONFIG_LEN) {
+       if (strlen(opt) >= MAX_CONFIG_LEN) {
                printk(KERN_ERR "kgdboc: config string too long\n");
                return -ENOSPC;
        }