Browse Source

[media] ttusb-dec: buffer overflow in ioctl

We need to add a limit check here so we don't overflow the buffer.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Dan Carpenter 11 years ago
parent
commit
f2e323ec96
1 changed files with 3 additions and 0 deletions
  1. 3 0
      drivers/media/usb/ttusb-dec/ttusbdecfe.c

+ 3 - 0
drivers/media/usb/ttusb-dec/ttusbdecfe.c

@@ -156,6 +156,9 @@ static int ttusbdecfe_dvbs_diseqc_send_master_cmd(struct dvb_frontend* fe, struc
 		   0x00, 0x00, 0x00, 0x00,
 		   0x00, 0x00, 0x00, 0x00,
 		   0x00, 0x00 };
 		   0x00, 0x00 };
 
 
+	if (cmd->msg_len > sizeof(b) - 4)
+		return -EINVAL;
+
 	memcpy(&b[4], cmd->msg, cmd->msg_len);
 	memcpy(&b[4], cmd->msg, cmd->msg_len);
 
 
 	state->config->send_command(fe, 0x72,
 	state->config->send_command(fe, 0x72,