diff options
author | Roel Kluin <roel.kluin@gmail.com> | 2009-08-06 19:09:51 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-09-23 09:46:32 -0400 |
commit | 417b57b3e4e34df07a2aceaf75baffeacdd9385f (patch) | |
tree | 0e0454a8f1cf0a40633dd42a94da9935573bf292 | |
parent | d0defb855c8504c49b92bdc0203689ce9b4cf7ba (diff) |
USB: gadget: Read buffer overflow
Check whether index is within bounds before testing the element.
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Cc: David Brownell <david-b@pacbell.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/usb/gadget/composite.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index 59e85234fa0a..d05397ec8a18 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c | |||
@@ -602,7 +602,7 @@ static int get_string(struct usb_composite_dev *cdev, | |||
602 | } | 602 | } |
603 | } | 603 | } |
604 | 604 | ||
605 | for (len = 0; s->wData[len] && len <= 126; len++) | 605 | for (len = 0; len <= 126 && s->wData[len]; len++) |
606 | continue; | 606 | continue; |
607 | if (!len) | 607 | if (!len) |
608 | return -EINVAL; | 608 | return -EINVAL; |