[PATCH] Fix uninitialized struct sockaddr_hci memory passed to bind()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux