From: One Thousand Gnomes Date: Mon, 15 Feb 2016 19:04:56 +0000 (+0000) Subject: rt2x00: unterminated strlen of user data X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=9cc3fdc86c6006bae878da6d2d14c1633064a12f;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git rt2x00: unterminated strlen of user data The buffer needs to be zero terminated in case the user data is not. Otherwise we run off the end of the buffer. Signed-off-by: Alan Cox Reviewed-by: Julian Calaby Signed-off-by: Kalle Valo --- diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00debug.c b/drivers/net/wireless/ralink/rt2x00/rt2x00debug.c index 25ee3cb8e982..72ae530e4a3b 100644 --- a/drivers/net/wireless/ralink/rt2x00/rt2x00debug.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00debug.c @@ -478,7 +478,7 @@ static ssize_t rt2x00debug_write_##__name(struct file *file, \ { \ struct rt2x00debug_intf *intf = file->private_data; \ const struct rt2x00debug *debug = intf->debug; \ - char line[16]; \ + char line[17]; \ size_t size; \ unsigned int index = intf->offset_##__name; \ __type value; \ @@ -494,7 +494,8 @@ static ssize_t rt2x00debug_write_##__name(struct file *file, \ \ if (copy_from_user(line, buf, length)) \ return -EFAULT; \ - \ + line[16] = 0; \ + \ size = strlen(line); \ value = simple_strtoul(line, NULL, 0); \ \