lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20251122093056.50774-1-sameekshasankpal@gmail.com>
Date: Sat, 22 Nov 2025 15:00:56 +0530
From: Sameeksha Sankpal <sameekshasankpal@...il.com>
To: mchehab@...nel.org
Cc: christophe.jaillet@...adoo.fr,
	hverkuil@...nel.org,
	linux-media@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	Sameeksha Sankpal <sameekshasankpal@...il.com>,
	syzbot+a83ee2dae0e6cc6cd3aa@...kaller.appspotmail.com
Subject: [PATCH] media: dtv5100: fix buffer overflow in dtv5100_i2c_msg()

syzbot reported a field-spanning write where rlen (4096 bytes) is
copied into st->data, which is only 80 bytes in size. This causes a
buffer overflow and triggers KASAN warnings.

Clamp the copy size using min_t() to ensure we never write beyond the
bounds of st->data, and pass the clamped size to usb_control_msg().

This fixes the following syzbot report:
Reported-by: syzbot+a83ee2dae0e6cc6cd3aa@...kaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=a83ee2dae0e6cc6cd3aa
Signed-off-by: Sameeksha Sankpal <sameekshasankpal@...il.com>
---
 drivers/media/usb/dvb-usb/dtv5100.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/media/usb/dvb-usb/dtv5100.c b/drivers/media/usb/dvb-usb/dtv5100.c
index 3d85c6f7f6ec..df1ce9b49ecf 100644
--- a/drivers/media/usb/dvb-usb/dtv5100.c
+++ b/drivers/media/usb/dvb-usb/dtv5100.c
@@ -55,10 +55,13 @@ static int dtv5100_i2c_msg(struct dvb_usb_device *d, u8 addr,
 	}
 	index = (addr << 8) + wbuf[0];
 
-	memcpy(st->data, rbuf, rlen);
+	/* Prevent buffer overflow: st->data is 80 bytes */
+	size_t copy_len = min_t(size_t, rlen, sizeof(st->data));
+
+	memcpy(st->data, rbuf, copy_len);
 	msleep(1); /* avoid I2C errors */
 	return usb_control_msg(d->udev, pipe, request,
-			       type, value, index, st->data, rlen,
+			       type, value, index, st->data, copy_len,
 			       DTV5100_USB_TIMEOUT);
 }
 
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ