Commit 9cc3fdc8 authored by One Thousand Gnomes's avatar One Thousand Gnomes Committed by Kalle Valo

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: default avatarAlan Cox <alan@linux.intel.com>
Reviewed-by: default avatarJulian Calaby <julian.calaby@gmail.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 7b5acd11
...@@ -478,7 +478,7 @@ static ssize_t rt2x00debug_write_##__name(struct file *file, \ ...@@ -478,7 +478,7 @@ static ssize_t rt2x00debug_write_##__name(struct file *file, \
{ \ { \
struct rt2x00debug_intf *intf = file->private_data; \ struct rt2x00debug_intf *intf = file->private_data; \
const struct rt2x00debug *debug = intf->debug; \ const struct rt2x00debug *debug = intf->debug; \
char line[16]; \ char line[17]; \
size_t size; \ size_t size; \
unsigned int index = intf->offset_##__name; \ unsigned int index = intf->offset_##__name; \
__type value; \ __type value; \
...@@ -494,6 +494,7 @@ static ssize_t rt2x00debug_write_##__name(struct file *file, \ ...@@ -494,6 +494,7 @@ static ssize_t rt2x00debug_write_##__name(struct file *file, \
\ \
if (copy_from_user(line, buf, length)) \ if (copy_from_user(line, buf, length)) \
return -EFAULT; \ return -EFAULT; \
line[16] = 0; \
\ \
size = strlen(line); \ size = strlen(line); \
value = simple_strtoul(line, NULL, 0); \ value = simple_strtoul(line, NULL, 0); \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment