Browse Source

[PATCH] module: strlen_user() race fix

Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Andrew Morton 20 năm trước cách đây
mục cha
commit
8e08b75686
1 tập tin đã thay đổi với 3 bổ sung0 xóa
  1. 3 0
      kernel/module.c

+ 3 - 0
kernel/module.c

@@ -1670,6 +1670,9 @@ static struct module *load_module(void __user *umod,
 		goto free_mod;
 	}
 
+	/* Userspace could have altered the string after the strlen_user() */
+	args[arglen - 1] = '\0';
+
 	if (find_module(mod->name)) {
 		err = -EEXIST;
 		goto free_mod;