From: Alan <gnomes@lxorguk.ukuu.org.uk>
To: linux-wireless@vger.kernel.org, kvalo@codeaurora.org
Subject: [PATCH] rt2x00: unterminated strlen of user data
Date: Mon, 15 Feb 2016 19:04:56 +0000 [thread overview]
Message-ID: <20160215190451.19883.12408.stgit@localhost.localdomain> (raw)
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>
---
drivers/net/wireless/ralink/rt2x00/rt2x00debug.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00debug.c b/drivers/net/wireless/ralink/rt2x00/rt2x00debug.c
index 25ee3cb..72ae530 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); \
\
next reply other threads:[~2016-02-15 19:05 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-15 19:04 Alan [this message]
2016-02-16 6:36 ` [PATCH] rt2x00: unterminated strlen of user data Souptick Joarder
2016-02-17 0:08 ` Julian Calaby
2016-02-17 13:49 ` Souptick Joarder
2016-02-18 0:19 ` Julian Calaby
2016-02-18 3:43 ` Souptick Joarder
2016-02-17 0:09 ` Julian Calaby
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160215190451.19883.12408.stgit@localhost.localdomain \
--to=gnomes@lxorguk.ukuu.org.uk \
--cc=kvalo@codeaurora.org \
--cc=linux-wireless@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox