Skip to content

Commit fec87f9

Browse files
seanyoungSomasundaram Krishnasamy
authored andcommitted
media: technisat-usb2: break out of loop at end of buffer
commit 0c4df39 upstream. 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]> Signed-off-by: Greg Kroah-Hartman <[email protected]> Orabug: 31224553 CVE: CVE-2019-15505 (cherry picked from commit 120d567) Signed-off-by: Dan Duval <[email protected]> Reviewed-by: John Donnelly <[email protected]> Signed-off-by: Somasundaram Krishnasamy <[email protected]>
1 parent 7e1bc0e commit fec87f9

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

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

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -607,10 +607,9 @@ static int technisat_usb2_frontend_attach(struct dvb_usb_adapter *a)
607607
static int technisat_usb2_get_ir(struct dvb_usb_device *d)
608608
{
609609
struct technisat_usb2_state *state = d->priv;
610-
u8 *buf = state->buf;
611-
u8 *b;
612-
int ret;
613610
struct ir_raw_event ev;
611+
u8 *buf = state->buf;
612+
int i, ret;
614613

615614
buf[0] = GET_IR_DATA_VENDOR_REQUEST;
616615
buf[1] = 0x08;
@@ -646,26 +645,25 @@ static int technisat_usb2_get_ir(struct dvb_usb_device *d)
646645
return 0; /* no key pressed */
647646

648647
/* decoding */
649-
b = buf+1;
650648

651649
#if 0
652650
deb_rc("RC: %d ", ret);
653-
debug_dump(b, ret, deb_rc);
651+
debug_dump(buf + 1, ret, deb_rc);
654652
#endif
655653

656654
ev.pulse = 0;
657-
while (1) {
658-
ev.pulse = !ev.pulse;
659-
ev.duration = (*b * FIRMWARE_CLOCK_DIVISOR * FIRMWARE_CLOCK_TICK) / 1000;
660-
ir_raw_event_store(d->rc_dev, &ev);
661-
662-
b++;
663-
if (*b == 0xff) {
655+
for (i = 1; i < ARRAY_SIZE(state->buf); i++) {
656+
if (buf[i] == 0xff) {
664657
ev.pulse = 0;
665658
ev.duration = 888888*2;
666659
ir_raw_event_store(d->rc_dev, &ev);
667660
break;
668661
}
662+
663+
ev.pulse = !ev.pulse;
664+
ev.duration = (buf[i] * FIRMWARE_CLOCK_DIVISOR *
665+
FIRMWARE_CLOCK_TICK) / 1000;
666+
ir_raw_event_store(d->rc_dev, &ev);
669667
}
670668

671669
ir_raw_event_handle(d->rc_dev);

0 commit comments

Comments
 (0)