提交 cf3b576d 编写于 作者: D Dan Carpenter 提交者: Mauro Carvalho Chehab

[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: NDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: NMauro Carvalho Chehab <mchehab@osg.samsung.com>
上级 e947d9ad
...@@ -236,6 +236,9 @@ static int si21_writeregs(struct si21xx_state *state, u8 reg1, ...@@ -236,6 +236,9 @@ static int si21_writeregs(struct si21xx_state *state, u8 reg1,
.len = len + 1 .len = len + 1
}; };
if (len > sizeof(buf) - 1)
return -EINVAL;
msg.buf[0] = reg1; msg.buf[0] = reg1;
memcpy(msg.buf + 1, data, len); memcpy(msg.buf + 1, data, len);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册