Skip to content

Commit

Permalink
USB: gadget: Read buffer overflow
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Roel Kluin authored and Greg Kroah-Hartman committed Sep 23, 2009
1 parent d0defb8 commit 417b57b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/usb/gadget/composite.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 417b57b

Please sign in to comment.