Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1715180

[PATCH 3.2 26/59] [media] zr364xx: enforce minimum size when reading header

From Ben Hutchings <ben@decadent.org.uk>
Newsgroups linux.kernel
Subject [PATCH 3.2 26/59] [media] zr364xx: enforce minimum size when reading header
Date 2017-08-18 16:30 +0200
Message-ID <ufQrF-4YI-23@gated-at.bofh.it> (permalink)
References <ufPlU-4d0-25@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


3.2.92-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Alyssa Milburn <amilburn@zall.org>

commit ee0fe833d96793853335844b6d99fb76bd12cbeb upstream.

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>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
[bwh: Backported to 3.2: adjust filename]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/media/video/zr364xx.c | 8 ++++++++
 1 file changed, 8 insertions(+)

--- a/drivers/media/video/zr364xx.c
+++ b/drivers/media/video/zr364xx.c
@@ -611,6 +611,14 @@ static int zr364xx_read_video_callback(s
 	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;
 

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH 3.2 26/59] [media] zr364xx: enforce minimum size when  reading header Ben Hutchings <ben@decadent.org.uk> - 2017-08-18 16:30 +0200

csiph-web