From: Anderson Lizardo <anderson.lizardo@openbossa.org>
To: linux-bluetooth@vger.kernel.org
Cc: Anderson Lizardo <anderson.lizardo@openbossa.org>
Subject: [PATCH] Fix uninitialized struct sockaddr_hci memory passed to bind()
Date: Thu, 20 Jan 2011 17:02:48 -0400 [thread overview]
Message-ID: <1295557368-9737-1-git-send-email-anderson.lizardo@openbossa.org> (raw)
The bind() call in open_socket() was passing a struct sockaddr_hci to
bind() with two uninitialized bytes. This caused "Invalid argument" errors
on kernels which do strict checks of struct sockaddr_hci fields.
---
src/hcidump.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/src/hcidump.c b/src/hcidump.c
index b8eb1e4..97aae5d 100644
--- a/src/hcidump.c
+++ b/src/hcidump.c
@@ -603,6 +603,7 @@ static int open_socket(int dev, unsigned long flags)
}
/* Bind socket to the HCI device */
+ memset(&addr, 0, sizeof(addr));
addr.hci_family = AF_BLUETOOTH;
addr.hci_dev = dev;
if (bind(sk, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
--
1.7.0.4
next reply other threads:[~2011-01-20 21:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-20 21:02 Anderson Lizardo [this message]
2011-01-21 6:56 ` [PATCH] Fix uninitialized struct sockaddr_hci memory passed to bind() Johan Hedberg
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=1295557368-9737-1-git-send-email-anderson.lizardo@openbossa.org \
--to=anderson.lizardo@openbossa.org \
--cc=linux-bluetooth@vger.kernel.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