From: Dan Carpenter Date: Mon, 15 Mar 2010 12:28:00 +0000 (-0500) Subject: kgdboc,kgdbts: strlen() doesn't count the terminator X-Git-Tag: firefly_0821_release~7613^2~1781^2~3 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=adb4b83c12f9d966ea3478aa14c60511467c9916;p=firefly-linux-kernel-4.4.55.git 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 Signed-off-by: Jason Wessel --- 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) 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; } 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) 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; }