Skip to content

Commit

Permalink
kgdboc,kgdbts: strlen() doesn't count the terminator
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Dan Carpenter authored and Jason Wessel committed Mar 25, 2011
1 parent 521cb40 commit adb4b83
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion drivers/misc/kgdbts.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/tty/serial/kgdboc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit adb4b83

Please sign in to comment.