提交 417b57b3 编写于 作者: R Roel Kluin 提交者: Greg Kroah-Hartman

USB: gadget: Read buffer overflow

Check whether index is within bounds before testing the element.
Signed-off-by: NRoel Kluin <roel.kluin@gmail.com>
Cc: David Brownell <david-b@pacbell.net>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 d0defb85
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册