From: Insu Yun <wuninsu-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: marcel-kz+m5ild9QBg9hUCZPvPmw@public.gmane.org,
gustavo-THi1TnShQwVAfugRpC6u6w@public.gmane.org,
johan.hedberg-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org,
peter-WaGBZJeGNqdsbIuE7sb01tBPR1lH4CV8@public.gmane.org,
jaganath.k-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org,
ying.xue-CWA4WttNNZF54TAoqtyWWQ@public.gmane.org,
ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org,
linux-bluetooth-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: taesoo-/4noJB3qBVQ3uPMLIKxrzw@public.gmane.org,
yeongjin.jang-/4noJB3qBVQ3uPMLIKxrzw@public.gmane.org,
insu-/4noJB3qBVQ3uPMLIKxrzw@public.gmane.org,
changwoo-/4noJB3qBVQ3uPMLIKxrzw@public.gmane.org,
Insu Yun <wuninsu-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Subject: [PATCH] rfcomm: fix information leak in rfcomm_sock_bind
Date: Tue, 5 Jan 2016 23:36:33 -0500 [thread overview]
Message-ID: <1452054993-76111-1-git-send-email-wuninsu@gmail.com> (raw)
if addr_len < sizeof(sa), sa.rc_bdaddr(4bytes) can be leaked
by using rfcomm_sock_getname()
Signed-off-by: Insu Yun <wuninsu-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
net/bluetooth/rfcomm/sock.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/net/bluetooth/rfcomm/sock.c b/net/bluetooth/rfcomm/sock.c
index 7511df7..d61dfdc 100644
--- a/net/bluetooth/rfcomm/sock.c
+++ b/net/bluetooth/rfcomm/sock.c
@@ -336,14 +336,15 @@ static int rfcomm_sock_bind(struct socket *sock, struct sockaddr *addr, int addr
{
struct sockaddr_rc sa;
struct sock *sk = sock->sk;
- int len, err = 0;
+ int err = 0;
if (!addr || addr->sa_family != AF_BLUETOOTH)
return -EINVAL;
- memset(&sa, 0, sizeof(sa));
- len = min_t(unsigned int, sizeof(sa), addr_len);
- memcpy(&sa, addr, len);
+ if (addr_len != sizeof(sa))
+ return -EINVAL;
+
+ memcpy(&sa, addr, addr_len);
BT_DBG("sk %p %pMR", sk, &sa.rc_bdaddr);
--
1.9.1
next reply other threads:[~2016-01-06 4:36 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-06 4:36 Insu Yun [this message]
2016-01-06 6:48 ` [PATCH] rfcomm: fix information leak in rfcomm_sock_bind Marcel Holtmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1452054993-76111-1-git-send-email-wuninsu@gmail.com \
--to=wuninsu-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=changwoo-/4noJB3qBVQ3uPMLIKxrzw@public.gmane.org \
--cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org \
--cc=ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org \
--cc=gustavo-THi1TnShQwVAfugRpC6u6w@public.gmane.org \
--cc=insu-/4noJB3qBVQ3uPMLIKxrzw@public.gmane.org \
--cc=jaganath.k-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
--cc=johan.hedberg-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=linux-bluetooth-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=marcel-kz+m5ild9QBg9hUCZPvPmw@public.gmane.org \
--cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=peter-WaGBZJeGNqdsbIuE7sb01tBPR1lH4CV8@public.gmane.org \
--cc=taesoo-/4noJB3qBVQ3uPMLIKxrzw@public.gmane.org \
--cc=yeongjin.jang-/4noJB3qBVQ3uPMLIKxrzw@public.gmane.org \
--cc=ying.xue-CWA4WttNNZF54TAoqtyWWQ@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).