提交 7d01cd26 编写于 作者: O Oleksij Rempel 提交者: Dmitry Torokhov

Input: zforce - don't overwrite the stack

If we get a corrupted packet with PAYLOAD_LENGTH > FRAME_MAXSIZE, we
will silently overwrite the stack.

Cc: stable@vger.kernel.org
Signed-off-by: NOleksij Rempel <external.Oleksij.Rempel@de.bosch.com>
Signed-off-by: NDirk Behme <dirk.behme@de.bosch.com>
Signed-off-by: NDmitry Torokhov <dmitry.torokhov@gmail.com>
上级 dbf3c370
......@@ -429,7 +429,7 @@ static int zforce_read_packet(struct zforce_ts *ts, u8 *buf)
goto unlock;
}
if (buf[PAYLOAD_LENGTH] == 0) {
if (buf[PAYLOAD_LENGTH] == 0 || buf[PAYLOAD_LENGTH] > FRAME_MAXSIZE) {
dev_err(&client->dev, "invalid payload length: %d\n",
buf[PAYLOAD_LENGTH]);
ret = -EIO;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册