Commit adb4b83c12f9d966ea3478aa14c60511467c9916

Authored by Dan Carpenter
Committed by Jason Wessel
1 parent 521cb40b0c

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>

Showing 2 changed files with 2 additions and 2 deletions Side-by-side Diff

drivers/misc/kgdbts.c
... ... @@ -988,7 +988,7 @@
988 988  
989 989 static int kgdbts_option_setup(char *opt)
990 990 {
991   - if (strlen(opt) > MAX_CONFIG_LEN) {
  991 + if (strlen(opt) >= MAX_CONFIG_LEN) {
992 992 printk(KERN_ERR "kgdbts: config string too long\n");
993 993 return -ENOSPC;
994 994 }
drivers/tty/serial/kgdboc.c
... ... @@ -131,7 +131,7 @@
131 131  
132 132 static int kgdboc_option_setup(char *opt)
133 133 {
134   - if (strlen(opt) > MAX_CONFIG_LEN) {
  134 + if (strlen(opt) >= MAX_CONFIG_LEN) {
135 135 printk(KERN_ERR "kgdboc: config string too long\n");
136 136 return -ENOSPC;
137 137 }