[media] digitv: limit messages to buffer size

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>
This commit is contained in:
Alyssa Milburn 2017-04-01 14:33:42 -03:00 committed by Mauro Carvalho Chehab
parent e8357cdec3
commit 821117dc21
1 changed files with 3 additions and 0 deletions

View 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);