Patchwork [lucid/fsl-imx51,maverick/ti-omap4,CVE,1/1] Bluetooth: bnep: fix buffer overflow

login
register
mail settings
Submitter Andy Whitcroft
Date July 26, 2011, 6:51 p.m.
Message ID <1311706273-14191-3-git-send-email-apw@canonical.com>
Download mbox | patch
Permalink /patch/106908/
State New
Headers show

Comments

Andy Whitcroft - July 26, 2011, 6:51 p.m.
From: Vasiliy Kulikov <segoon@openwall.com>

Struct ca is copied from userspace.  It is not checked whether the "device"
field is NULL terminated.  This potentially leads to BUG() inside of
alloc_netdev_mqs() and/or information leak by creating a device with a name
made of contents of kernel stack.

Signed-off-by: Vasiliy Kulikov <segoon@openwall.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>

(cherry picked from commit 43629f8f5ea32a998d06d1bb41eefa0e821ff573)
CVE-2011-1079
BugLink: http://bugs.launchpad.net/bugs/816544
Signed-off-by: Andy Whitcroft <apw@canonical.com>
---
 net/bluetooth/bnep/sock.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

Patch

diff --git a/net/bluetooth/bnep/sock.c b/net/bluetooth/bnep/sock.c
index e857628..efc85dc 100644
--- a/net/bluetooth/bnep/sock.c
+++ b/net/bluetooth/bnep/sock.c
@@ -88,6 +88,7 @@  static int bnep_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long
 			sockfd_put(nsock);
 			return -EBADFD;
 		}
+		ca.device[sizeof(ca.device)-1] = 0;
 
 		err = bnep_add_connection(&ca, nsock);
 		if (!err) {