]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
[media] digitv: limit messages to buffer size
authorAlyssa Milburn <amilburn@zall.org>
Sat, 1 Apr 2017 17:33:42 +0000 (14:33 -0300)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Tue, 18 Apr 2017 15:52:41 +0000 (12:52 -0300)
Return an error rather than memcpy()ing beyond the end of the buffer.
Internal callers use appropriate sizes, but digitv_i2c_xfer may not.

Signed-off-by: Alyssa Milburn <amilburn@zall.org>
Cc: stable@vger.kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/usb/dvb-usb/digitv.c

index 4284f6984dc1ffe14698b6fcdc42aad8cf69bf32..475a3c0cdee7f88a9630f337cd9d0aaf59f2e177 100644 (file)
@@ -33,6 +33,9 @@ static int digitv_ctrl_msg(struct dvb_usb_device *d,
 
        wo = (rbuf == NULL || rlen == 0); /* write-only */
 
+       if (wlen > 4 || rlen > 4)
+               return -EIO;
+
        memset(st->sndbuf, 0, 7);
        memset(st->rcvbuf, 0, 7);