* [PATCH] Fix uninitialized struct sockaddr_hci memory passed to bind()
@ 2011-01-20 21:02 Anderson Lizardo
2011-01-21 6:56 ` Johan Hedberg
0 siblings, 1 reply; 2+ messages in thread
From: Anderson Lizardo @ 2011-01-20 21:02 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Anderson Lizardo
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Fix uninitialized struct sockaddr_hci memory passed to bind()
2011-01-20 21:02 [PATCH] Fix uninitialized struct sockaddr_hci memory passed to bind() Anderson Lizardo
@ 2011-01-21 6:56 ` Johan Hedberg
0 siblings, 0 replies; 2+ messages in thread
From: Johan Hedberg @ 2011-01-21 6:56 UTC (permalink / raw)
To: Anderson Lizardo; +Cc: linux-bluetooth
Hi,
On Thu, Jan 20, 2011, Anderson Lizardo wrote:
> 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(-)
Pushed upstream. Thanks.
Johan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-01-21 6:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-20 21:02 [PATCH] Fix uninitialized struct sockaddr_hci memory passed to bind() Anderson Lizardo
2011-01-21 6:56 ` Johan Hedberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox