From: Jim Cromie Date: Mon, 19 Dec 2011 22:12:29 +0000 (-0500) Subject: dynamic_debug: replace strcpy with strlcpy, in ddebug_setup_query() X-Git-Tag: MMI-PSA29.97-13-9~17269^2~71 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=bc757f6f5bf4e9251bbc1a3419c94ffe9fd3e2ee;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git dynamic_debug: replace strcpy with strlcpy, in ddebug_setup_query() Replace strcpy with strlcpy, and add define for the size constant. [jbaron@redhat.com: Use DDEBUG_STRING_SIZE for overflow check] Signed-off-by: Jim Cromie Signed-off-by: Jason Baron Signed-off-by: Greg Kroah-Hartman --- diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 8c88b892ebb8..6fc8622f0a83 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -525,14 +525,16 @@ EXPORT_SYMBOL(__dynamic_netdev_dbg); #endif -static __initdata char ddebug_setup_string[1024]; +#define DDEBUG_STRING_SIZE 1024 +static __initdata char ddebug_setup_string[DDEBUG_STRING_SIZE]; + static __init int ddebug_setup_query(char *str) { - if (strlen(str) >= 1024) { + if (strlen(str) >= DDEBUG_STRING_SIZE) { pr_warn("ddebug boot param string too large\n"); return 0; } - strcpy(ddebug_setup_string, str); + strlcpy(ddebug_setup_string, str, DDEBUG_STRING_SIZE); return 1; }