Skip to content

Commit

Permalink
media: dw2102: fix a potential buffer overflow
Browse files Browse the repository at this point in the history
As pointed by smatch:
	 drivers/media/usb/dvb-usb/dw2102.c:802 su3000_i2c_transfer() error: __builtin_memcpy() '&state->data[4]' too small (64 vs 67)

That seemss to be due to a wrong copy-and-paste.

Fixes: 0e148a5 ("media: dw2102: Don't translate i2c read into write")

Reported-by: Hans Verkuil <[email protected]>
Reviewed-by: Hans Verkuil <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
  • Loading branch information
mchehab committed Apr 29, 2024
1 parent 9789ea6 commit 1c73d0b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/media/usb/dvb-usb/dw2102.c
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,7 @@ static int su3000_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[],

if (msg[j].flags & I2C_M_RD) {
/* single read */
if (1 + msg[j].len > sizeof(state->data)) {
if (4 + msg[j].len > sizeof(state->data)) {
warn("i2c rd: len=%d is too big!\n", msg[j].len);
num = -EOPNOTSUPP;
break;
Expand Down

0 comments on commit 1c73d0b

Please sign in to comment.