Skip to content

Commit

Permalink
[media] dvb-core: prevent some corruption the legacy ioctl
Browse files Browse the repository at this point in the history
Quite a few of the ->diseqc_send_master_cmd() implementations don't
check cmd->msg_len so it can lead to memory corruption.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
  • Loading branch information
Dan Carpenter authored and Mauro Carvalho Chehab committed Jun 10, 2015
1 parent 5dce1ee commit 8d7e506
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion drivers/media/dvb-core/dvb_frontend.c
Original file line number Diff line number Diff line change
Expand Up @@ -2384,7 +2384,13 @@ static int dvb_frontend_ioctl_legacy(struct file *file,

case FE_DISEQC_SEND_MASTER_CMD:
if (fe->ops.diseqc_send_master_cmd) {
err = fe->ops.diseqc_send_master_cmd(fe, (struct dvb_diseqc_master_cmd*) parg);
struct dvb_diseqc_master_cmd *cmd = parg;

if (cmd->msg_len > sizeof(cmd->msg)) {
err = -EINVAL;
break;
}
err = fe->ops.diseqc_send_master_cmd(fe, cmd);
fepriv->state = FESTATE_DISEQC;
fepriv->status = 0;
}
Expand Down

0 comments on commit 8d7e506

Please sign in to comment.