Skip to contentSkip to conversation

media: rc-core: use %s in rc_map_get() module load

PATCH New Kees Cook 1 participant 1 message Mar 11, 2014

Subsystems (2)
lore
Share & tools
lore

Kees Cook

author
#0 lore raw

PATCH 1/1 media: rc-core: use %s in rc_map_get() module load

rc_map_get() takes a single string literal for the module to load, so make sure it cannot be used as a format string in the call to request_module().

---
On another security note, this raw request_module() call should have some kind of prefix associated with it to make sure it can't be used to load arbitrary modules. For example, request_module("probe-%s", name) or something, as done for crypto, binfmts, etc.

---
 drivers/media/rc/rc-main.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/rc/rc-main.c +1 -1
index 02e2f38c9c85..dca97aa0a51e 100644
@@ -62,7 +62,7 @@ struct rc_map *rc_map_get(const char *name)
 	map = seek_rc_map(name);
 #ifdef MODULE
 	if (!map) {
-		int rc = request_module(name);
+		int rc = request_module("%s", name);
 		if (rc < 0) {
 			printk(KERN_ERR "Couldn't load IR keymap %s\n", name);
 			return NULL;
Signature · 6 lines
1.7.9.5


-- 
Kees Cook
Chrome OS Security