uevent: don't pass envp_ext[] as format string in kobject_uevent_env()
authorTejun Heo <tj@kernel.org>
Thu, 13 Nov 2008 04:20:00 +0000 (13:20 +0900)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 6 Jan 2009 18:44:31 +0000 (10:44 -0800)
kobject_uevent_env() uses envp_ext[] as verbatim format string which
can cause problems ranging from unexpectedly mangled string to oops if
a string in envp_ext[] contains substring which can be interpreted as
format.  Fix it.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
lib/kobject_uevent.c

index 3f914725bda8ae6b278070b52258940bc4b68489..ca215bc2329a6fdf38fe901808f6cb013f26fddd 100644 (file)
@@ -165,7 +165,7 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action,
        /* keys passed in from the caller */
        if (envp_ext) {
                for (i = 0; envp_ext[i]; i++) {
-                       retval = add_uevent_var(env, envp_ext[i]);
+                       retval = add_uevent_var(env, "%s", envp_ext[i]);
                        if (retval)
                                goto exit;
                }