aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnderson Lizardo <anderson.lizardo@openbossa.org>2011-01-20 17:02:48 -0400
committerJohan Hedberg <johan.hedberg@nokia.com>2011-01-21 12:26:11 +0530
commitd27c8ec891ebb719c1192e091410c5c824bc8afd (patch)
treec9084592c5a89b61c3d678354d4324d1189ffee3
parent06c932e3c8957e9ac2eb7b3e94f08678e5583ee9 (diff)
downloadhcidump-d27c8ec891ebb719c1192e091410c5c824bc8afd.tar.gz
Fix uninitialized struct sockaddr_hci memory passed to bind()
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.
-rw-r--r--src/hcidump.c1
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) {