aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoel Kluin <[email protected]>2009-08-06 16:09:51 -0700
committerGreg Kroah-Hartman <[email protected]>2009-09-23 06:46:32 -0700
commit417b57b3e4e34df07a2aceaf75baffeacdd9385f (patch)
tree0e0454a8f1cf0a40633dd42a94da9935573bf292
parentd0defb855c8504c49b92bdc0203689ce9b4cf7ba (diff)
USB: gadget: Read buffer overflow
Check whether index is within bounds before testing the element. Signed-off-by: Roel Kluin <[email protected]> Cc: David Brownell <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
-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 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,
}
}
- for (len = 0; s->wData[len] && len <= 126; len++)
+ for (len = 0; len <= 126 && s->wData[len]; len++)
continue;
if (!len)
return -EINVAL;