From 9784dac19ce8ea0068bb4fd83d4722d7d8ed5d23 Mon Sep 17 00:00:00 2001 From: Matthias Ringwald Date: Mon, 20 Jan 2020 18:10:04 +0100 Subject: [PATCH] hci: validate size of hci inquiry events and num completed packet --- src/hci.c | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/src/hci.c b/src/hci.c index d2983038f..8d45f45ef 100644 --- a/src/hci.c +++ b/src/hci.c @@ -137,7 +137,7 @@ static void hci_emit_security_level(hci_con_handle_t con_handle, gap_security_le static void hci_connection_timeout_handler(btstack_timer_source_t *timer); static void hci_connection_timestamp(hci_connection_t *connection); static void hci_emit_l2cap_check_timeout(hci_connection_t *conn); -static void gap_inquiry_explode(uint8_t * packet); +static void gap_inquiry_explode(uint8_t *packet, uint16_t size); #endif static int hci_power_control_on(void); @@ -2083,8 +2083,11 @@ static void event_handler(uint8_t *packet, int size){ break; case HCI_EVENT_NUMBER_OF_COMPLETED_PACKETS:{ - int offset = 3; - for (i=0; i