mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-29 10:01:25 +00:00
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>
This commit is contained in:
parent
d0defb855c
commit
417b57b3e4
1 changed files with 1 additions and 1 deletions
|
@ -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;
|
continue;
|
||||||
if (!len)
|
if (!len)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue