Skip to content

Commit 0b3fae6

Browse files
pvts-matPlaidCat
authored andcommitted
media: technisat-usb2: break out of loop at end of buffer
jira VULN-7734 cve CVE-2019-15505 commit-author Sean Young <[email protected]> commit 0c4df39 upstream-diff Mainline fix 0c4df39 is based on changes introduced by 5d0f2df which `ciqcbr7_9' lacks. Insteasd of operating on the `d->priv->buf' buffer as in the original the logic is applied to the local array `buf[62]'. Ensure we do not access the buffer beyond the end if no 0xff byte is encountered. Reported-by: [email protected] Signed-off-by: Sean Young <[email protected]> Reviewed-by: Kees Cook <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]> (cherry picked from commit 0c4df39) Signed-off-by: Marcin Wcisło <[email protected]>
1 parent 3f2bd20 commit 0b3fae6

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

drivers/media/usb/dvb-usb/technisat-usb2.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -591,9 +591,10 @@ static int technisat_usb2_frontend_attach(struct dvb_usb_adapter *a)
591591

592592
static int technisat_usb2_get_ir(struct dvb_usb_device *d)
593593
{
594-
u8 buf[62], *b;
594+
u8 buf[62];
595595
int ret;
596596
struct ir_raw_event ev;
597+
int i;
597598

598599
buf[0] = GET_IR_DATA_VENDOR_REQUEST;
599600
buf[1] = 0x08;
@@ -629,26 +630,25 @@ static int technisat_usb2_get_ir(struct dvb_usb_device *d)
629630
return 0; /* no key pressed */
630631

631632
/* decoding */
632-
b = buf+1;
633633

634634
#if 0
635635
deb_rc("RC: %d ", ret);
636-
debug_dump(b, ret, deb_rc);
636+
debug_dump(buf + 1, ret, deb_rc);
637637
#endif
638638

639639
ev.pulse = 0;
640-
while (1) {
641-
ev.pulse = !ev.pulse;
642-
ev.duration = (*b * FIRMWARE_CLOCK_DIVISOR * FIRMWARE_CLOCK_TICK) / 1000;
643-
ir_raw_event_store(d->rc_dev, &ev);
644-
645-
b++;
646-
if (*b == 0xff) {
640+
for (i = 1; i < ARRAY_SIZE(buf); i++) {
641+
if (buf[i] == 0xff) {
647642
ev.pulse = 0;
648643
ev.duration = 888888*2;
649644
ir_raw_event_store(d->rc_dev, &ev);
650645
break;
651646
}
647+
648+
ev.pulse = !ev.pulse;
649+
ev.duration = (buf[i] * FIRMWARE_CLOCK_DIVISOR *
650+
FIRMWARE_CLOCK_TICK) / 1000;
651+
ir_raw_event_store(d->rc_dev, &ev);
652652
}
653653

654654
ir_raw_event_handle(d->rc_dev);

0 commit comments

Comments
 (0)