dynamic_debug: replace strcpy with strlcpy, in ddebug_setup_query()
authorJim Cromie <jim.cromie@gmail.com>
Mon, 19 Dec 2011 22:12:29 +0000 (17:12 -0500)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 24 Jan 2012 20:46:45 +0000 (12:46 -0800)
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 <jim.cromie@gmail.com>
Signed-off-by: Jason Baron <jbaron@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
lib/dynamic_debug.c

index 8c88b892ebb8e178b4ea4703ffde0be7ac053663..6fc8622f0a8343aafa1c976c8b8819d586939ee2 100644 (file)
@@ -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;
 }