From: Dan Carpenter Date: Tue, 9 Sep 2014 12:05:28 +0000 (-0300) Subject: [media] dvb: si21xx: buffer overflow in si21_writeregs() X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=cf3b576d52c1f0a204f0c8bdecc22a338f7ca5a4;p=openwrt%2Fstaging%2Fblogic.git [media] dvb: si21xx: buffer overflow in si21_writeregs() "len" is user controlled and can be up to 255. Anything more than 59 will cause a buffer overflow so we need to add a test for that. Signed-off-by: Dan Carpenter Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/dvb-frontends/si21xx.c b/drivers/media/dvb-frontends/si21xx.c index 73b47cc6a13b..16850e2bf02f 100644 --- a/drivers/media/dvb-frontends/si21xx.c +++ b/drivers/media/dvb-frontends/si21xx.c @@ -236,6 +236,9 @@ static int si21_writeregs(struct si21xx_state *state, u8 reg1, .len = len + 1 }; + if (len > sizeof(buf) - 1) + return -EINVAL; + msg.buf[0] = reg1; memcpy(msg.buf + 1, data, len);