module: Fix gratuitous sprintf in module.c
authorRusty Russell <rusty@rustcorp.com.au>
Tue, 29 Jan 2008 22:13:20 +0000 (17:13 -0500)
committerRusty Russell <rusty@rustcorp.com.au>
Tue, 29 Jan 2008 06:13:21 +0000 (17:13 +1100)
Andrew sent an older version of this patch: we shouldn't use sprintf
to copy a string.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
kernel/module.c

index 1731469..276abd7 100644 (file)
@@ -738,7 +738,7 @@ sys_delete_module(const char __user *name_user, unsigned int flags)
                mutex_lock(&module_mutex);
        }
        /* Store the name of the last unloaded module for diagnostic purposes */
-       sprintf(last_unloaded_module, mod->name);
+       strlcpy(last_unloaded_module, mod->name, sizeof(last_unloaded_module));
        free_module(mod);
 
  out: