]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.9.30/digitv-limit-messages-to-buffer-size.patch
Linux 4.14.95
[thirdparty/kernel/stable-queue.git] / releases / 4.9.30 / digitv-limit-messages-to-buffer-size.patch
1 From 821117dc21083a99dd99174c10848d70ff43de29 Mon Sep 17 00:00:00 2001
2 From: Alyssa Milburn <amilburn@zall.org>
3 Date: Sat, 1 Apr 2017 14:33:42 -0300
4 Subject: [media] digitv: limit messages to buffer size
5
6 From: Alyssa Milburn <amilburn@zall.org>
7
8 commit 821117dc21083a99dd99174c10848d70ff43de29 upstream.
9
10 Return an error rather than memcpy()ing beyond the end of the buffer.
11 Internal callers use appropriate sizes, but digitv_i2c_xfer may not.
12
13 Signed-off-by: Alyssa Milburn <amilburn@zall.org>
14 Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
15 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
16
17 ---
18 drivers/media/usb/dvb-usb/digitv.c | 3 +++
19 1 file changed, 3 insertions(+)
20
21 --- a/drivers/media/usb/dvb-usb/digitv.c
22 +++ b/drivers/media/usb/dvb-usb/digitv.c
23 @@ -33,6 +33,9 @@ static int digitv_ctrl_msg(struct dvb_us
24
25 wo = (rbuf == NULL || rlen == 0); /* write-only */
26
27 + if (wlen > 4 || rlen > 4)
28 + return -EIO;
29 +
30 memset(st->sndbuf, 0, 7);
31 memset(st->rcvbuf, 0, 7);
32