aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOne Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk>2016-02-15 14:04:56 -0500
committerKalle Valo <kvalo@codeaurora.org>2016-03-07 07:00:25 -0500
commit9cc3fdc86c6006bae878da6d2d14c1633064a12f (patch)
tree83130fdb8a3c609f1a74d295e867f420177bba03
parent7b5acd11a3ffec027abf4df2b30690a974873174 (diff)
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 <alan@linux.intel.com> Reviewed-by: Julian Calaby <julian.calaby@gmail.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
-rw-r--r--drivers/net/wireless/ralink/rt2x00/rt2x00debug.c5
1 files changed, 3 insertions, 2 deletions
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, \
478{ \ 478{ \
479 struct rt2x00debug_intf *intf = file->private_data; \ 479 struct rt2x00debug_intf *intf = file->private_data; \
480 const struct rt2x00debug *debug = intf->debug; \ 480 const struct rt2x00debug *debug = intf->debug; \
481 char line[16]; \ 481 char line[17]; \
482 size_t size; \ 482 size_t size; \
483 unsigned int index = intf->offset_##__name; \ 483 unsigned int index = intf->offset_##__name; \
484 __type value; \ 484 __type value; \
@@ -494,7 +494,8 @@ static ssize_t rt2x00debug_write_##__name(struct file *file, \
494 \ 494 \
495 if (copy_from_user(line, buf, length)) \ 495 if (copy_from_user(line, buf, length)) \
496 return -EFAULT; \ 496 return -EFAULT; \
497 \ 497 line[16] = 0; \
498 \
498 size = strlen(line); \ 499 size = strlen(line); \
499 value = simple_strtoul(line, NULL, 0); \ 500 value = simple_strtoul(line, NULL, 0); \
500 \ 501 \