summaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/composite.c
diff options
context:
space:
mode:
authorRoel Kluin <roel.kluin@gmail.com>2009-08-06 16:09:51 -0700
committerGreg Kroah-Hartman <gregkh@suse.de>2009-09-23 06:46:32 -0700
commit417b57b3e4e34df07a2aceaf75baffeacdd9385f (patch)
tree0e0454a8f1cf0a40633dd42a94da9935573bf292 /drivers/usb/gadget/composite.c
parentd0defb855c8504c49b92bdc0203689ce9b4cf7ba (diff)
downloadop-kernel-dev-417b57b3e4e34df07a2aceaf75baffeacdd9385f.zip
op-kernel-dev-417b57b3e4e34df07a2aceaf75baffeacdd9385f.tar.gz
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>
Diffstat (limited to 'drivers/usb/gadget/composite.c')
-rw-r--r--drivers/usb/gadget/composite.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index 59e8523..d05397e 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,
}
}
- for (len = 0; s->wData[len] && len <= 126; len++)
+ for (len = 0; len <= 126 && s->wData[len]; len++)
continue;
if (!len)
return -EINVAL;
OpenPOWER on IntegriCloud