mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-04 12:26:56 +07:00
[media] zr364xx: enforce minimum size when reading header
This code copies actual_length-128 bytes from the header, which will underflow if the received buffer is too small. Signed-off-by: Alyssa Milburn <amilburn@zall.org> Cc: stable@vger.kernel.org Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
This commit is contained in:
parent
821117dc21
commit
ee0fe833d9
@ -600,6 +600,14 @@ static int zr364xx_read_video_callback(struct zr364xx_camera *cam,
|
||||
ptr = pdest = frm->lpvbits;
|
||||
|
||||
if (frm->ulState == ZR364XX_READ_IDLE) {
|
||||
if (purb->actual_length < 128) {
|
||||
/* header incomplete */
|
||||
dev_info(&cam->udev->dev,
|
||||
"%s: buffer (%d bytes) too small to hold jpeg header. Discarding.\n",
|
||||
__func__, purb->actual_length);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
frm->ulState = ZR364XX_READ_FRAME;
|
||||
frm->cur_size = 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user