summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorItay Iellin <ieitayie@gmail.com>2022-05-07 15:32:48 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-05-15 20:40:26 +0300
commitfd129b65fb1c57cb3c178d5bccc34e17b9bb7803 (patch)
treefa788b90848d44b955fd39abe38ac33b5d106507 /include
parentc040648284bb307695d8797aea6a9b136dbbe571 (diff)
downloadlinux-fd129b65fb1c57cb3c178d5bccc34e17b9bb7803.tar.xz
Bluetooth: Fix the creation of hdev->name
commit 103a2f3255a95991252f8f13375c3a96a75011cd upstream. Set a size limit of 8 bytes of the written buffer to "hdev->name" including the terminating null byte, as the size of "hdev->name" is 8 bytes. If an id value which is greater than 9999 is allocated, then the "snprintf(hdev->name, sizeof(hdev->name), "hci%d", id)" function call would lead to a truncation of the id value in decimal notation. Set an explicit maximum id parameter in the id allocation function call. The id allocation function defines the maximum allocated id value as the maximum id parameter value minus one. Therefore, HCI_MAX_ID is defined as 10000. Signed-off-by: Itay Iellin <ieitayie@gmail.com> Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include')
-rw-r--r--include/net/bluetooth/hci_core.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 51afaaa68408..d42288a06af6 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -34,6 +34,9 @@
/* HCI priority */
#define HCI_PRIO_MAX 7
+/* HCI maximum id value */
+#define HCI_MAX_ID 10000
+
/* HCI Core structures */
struct inquiry_data {
bdaddr_t bdaddr;