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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tencent_EDCC88A7DB46D3D2F7C64449976EC56EE006@qq.com>
Date: Tue,  9 Apr 2024 21:42:51 +0800
From: Edward Adam Davis <eadavis@...com>
To: syzbot+837ba09d9db969068367@...kaller.appspotmail.com
Cc: johan.hedberg@...il.com,
	linux-bluetooth@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	luiz.dentz@...il.com,
	marcel@...tmann.org,
	syzkaller-bugs@...glegroups.com,
	netdev@...r.kernel.org
Subject: [PATCH] Bluetooth: fix oob in hci_sock_setsockopt

If len < sizeof(opt) it will trigger oob, so take the min of them.

Reported-by: syzbot+837ba09d9db969068367@...kaller.appspotmail.com
Signed-off-by: Edward Adam Davis <eadavis@...com>
---
 net/bluetooth/hci_sock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c
index 4ee1b976678b..cee7ec1adbd2 100644
--- a/net/bluetooth/hci_sock.c
+++ b/net/bluetooth/hci_sock.c
@@ -1946,7 +1946,7 @@ static int hci_sock_setsockopt_old(struct socket *sock, int level, int optname,
 
 	switch (optname) {
 	case HCI_DATA_DIR:
-		if (copy_from_sockptr(&opt, optval, sizeof(opt))) {
+		if (copy_from_sockptr(&opt, optval, min_t(int, sizeof(opt), len))) {
 			err = -EFAULT;
 			break;
 		}
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ