Commit 25379bf8 authored by Sean Young's avatar Sean Young Committed by Mauro Carvalho Chehab

[media] lirc: validate transmission ir data

The lirc interface allows 255 u32 spaces and pulses, which are usec. If
the driver can handle this (e.g. winbond-cir) you can produce hours of
meaningless IR data and there is no method of interrupting it.
Signed-off-by: default avatarSean Young <sean@mess.org>
Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
parent 58a61f99
...@@ -140,11 +140,20 @@ static ssize_t ir_lirc_transmit_ir(struct file *file, const char __user *buf, ...@@ -140,11 +140,20 @@ static ssize_t ir_lirc_transmit_ir(struct file *file, const char __user *buf,
goto out; goto out;
} }
for (i = 0; i < count; i++) {
if (txbuf[i] > IR_MAX_DURATION / 1000 - duration || !txbuf[i]) {
ret = -EINVAL;
goto out;
}
duration += txbuf[i];
}
ret = dev->tx_ir(dev, txbuf, count); ret = dev->tx_ir(dev, txbuf, count);
if (ret < 0) if (ret < 0)
goto out; goto out;
for (i = 0; i < ret; i++) for (duration = i = 0; i < ret; i++)
duration += txbuf[i]; duration += txbuf[i];
ret *= sizeof(unsigned int); ret *= sizeof(unsigned int);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment