diff options
author | Laurent Pinchart <laurent.pinchart@skynet.be> | 2008-07-03 23:34:59 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-07-20 06:17:34 -0400 |
commit | 233548a2fd934a0220db8b1521c0bc88c82e5e53 (patch) | |
tree | ccec004dce951f73add8e3b00f672e0ea091f3bd /drivers/media/video/uvc/uvc_driver.c | |
parent | 553b9fa47d67a77f6456bc969891a347bfb323dc (diff) |
V4L/DVB (8207): uvcvideo: Fix a buffer overflow in format descriptor parsing
Thanks to Oliver Neukum for catching and reporting this bug.
Signed-off-by: Laurent Pinchart <laurent.pinchart@skynet.be>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/uvc/uvc_driver.c')
-rw-r--r-- | drivers/media/video/uvc/uvc_driver.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/media/video/uvc/uvc_driver.c b/drivers/media/video/uvc/uvc_driver.c index 60ced589f898..86bb16d00173 100644 --- a/drivers/media/video/uvc/uvc_driver.c +++ b/drivers/media/video/uvc/uvc_driver.c | |||
@@ -298,7 +298,8 @@ static int uvc_parse_format(struct uvc_device *dev, | |||
298 | switch (buffer[2]) { | 298 | switch (buffer[2]) { |
299 | case VS_FORMAT_UNCOMPRESSED: | 299 | case VS_FORMAT_UNCOMPRESSED: |
300 | case VS_FORMAT_FRAME_BASED: | 300 | case VS_FORMAT_FRAME_BASED: |
301 | if (buflen < 27) { | 301 | n = buffer[2] == VS_FORMAT_UNCOMPRESSED ? 27 : 28; |
302 | if (buflen < n) { | ||
302 | uvc_trace(UVC_TRACE_DESCR, "device %d videostreaming" | 303 | uvc_trace(UVC_TRACE_DESCR, "device %d videostreaming" |
303 | "interface %d FORMAT error\n", | 304 | "interface %d FORMAT error\n", |
304 | dev->udev->devnum, | 305 | dev->udev->devnum, |