From: Rusty Russell Date: Tue, 29 Jan 2008 22:13:20 +0000 (-0500) Subject: module: Fix gratuitous sprintf in module.c X-Git-Tag: v2.6.25-rc1~1165^2~5 X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=efa5345e39d01deef349c120f55ac6b6eabe7457;p=~shefty%2Frdma-dev.git module: Fix gratuitous sprintf in module.c Andrew sent an older version of this patch: we shouldn't use sprintf to copy a string. Signed-off-by: Rusty Russell --- diff --git a/kernel/module.c b/kernel/module.c index 17314691d3c..276abd7b7ff 100644 --- a/kernel/module.c +++ b/kernel/module.c @@ -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: