[media] cx24117: fix a buffer overflow when checking userspace params
authorMauro Carvalho Chehab <mchehab@osg.samsung.com>
Tue, 28 Apr 2015 22:03:59 +0000 (19:03 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Thu, 30 Apr 2015 17:26:42 +0000 (14:26 -0300)
The maximum size for a DiSEqC command is 6, according to the
userspace API. However, the code allows to write up much more values:
drivers/media/dvb-frontends/cx24116.c:983 cx24116_send_diseqc_msg() error: buffer overflow 'd->msg' 6 <= 23

Cc: stable@vger.kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/dvb-frontends/cx24117.c

index acb965ce0358b70ec3a3770a59a66df83816299b..af6363573efd6ea80d81b5e760c283193b863c2c 100644 (file)
@@ -1043,7 +1043,7 @@ static int cx24117_send_diseqc_msg(struct dvb_frontend *fe,
        dev_dbg(&state->priv->i2c->dev, ")\n");
 
        /* Validate length */
-       if (d->msg_len > 15)
+       if (d->msg_len > sizeof(d->msg))
                return -EINVAL;
 
        /* DiSEqC message */