From: Dan Carpenter <dan.carpenter@oracle.com>
To: kernel-janitors@vger.kernel.org
Subject: [patch] staging: ft1000: add a range check in ft1000_ioctl()
Date: Fri, 03 May 2013 07:17:28 +0000 [thread overview]
Message-ID: <20130503071728.GA29653@elgon.mountain> (raw)
msglen comes from get_user() so we need to check that it's not too
large.
The first element of "pioctl_dpram" is a short which holds the size of
the data the user wants. I have chosen a limit which lets us fill the
rest of the struct.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
msglen is also apparently network endian? My guess is that we should
just delete this code instead of trying to fix it.
diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c b/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
index 3251d2e..e0056c9 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
@@ -703,6 +703,8 @@ static long ft1000_ioctl (struct file *file, unsigned int command,
break;
msglen = htons(msglen);
//DEBUG("FT1000:ft1000_ioctl:msg length = %x\n", msglen);
+ if (msglen > sizeof(*pioctl_dpram) - sizeof(short))
+ msglen = sizeof(*pioctl_dpram) - sizeof(short);
if(copy_to_user (&pioctl_dpram->pseudohdr, pdpram_blk->pbuffer, msglen))
{
DEBUG("FT1000:ft1000_ioctl: copy fault occurred\n");
next reply other threads:[~2013-05-03 7:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-03 7:17 Dan Carpenter [this message]
2013-05-03 7:53 ` [patch] staging: ft1000: add a range check in ft1000_ioctl() devendra.aaru
2013-05-05 14:23 ` Dan Carpenter
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=20130503071728.GA29653@elgon.mountain \
--to=dan.carpenter@oracle.com \
--cc=kernel-janitors@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