You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ja...@apache.org on 2026/05/20 07:38:04 UTC

(mynewt-nimble) branch master updated: nimble/transport/socket: Drop too big HCI events

This is an automated email from the ASF dual-hosted git repository.

sjanc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git


The following commit(s) were added to refs/heads/master by this push:
     new dcc4e4f02 nimble/transport/socket: Drop too big HCI events
dcc4e4f02 is described below

commit dcc4e4f026109eecd507de9479bb5019306a4a41
Author: Szymon Janc <sz...@codecoup.pl>
AuthorDate: Fri May 8 12:48:49 2026 +0200

    nimble/transport/socket: Drop too big HCI events
    
    If received H4 event is too big for configured mempool just drop it.
---
 nimble/transport/socket/src/ble_hci_socket.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/nimble/transport/socket/src/ble_hci_socket.c b/nimble/transport/socket/src/ble_hci_socket.c
index fb4fc75ff..ccd67855d 100644
--- a/nimble/transport/socket/src/ble_hci_socket.c
+++ b/nimble/transport/socket/src/ble_hci_socket.c
@@ -489,6 +489,15 @@ ble_hci_sock_rx_msg(void)
             }
             STATS_INC(hci_sock_stats, imsg);
             STATS_INC(hci_sock_stats, ievt);
+
+            /* There isn't much we can do if received event is too big */
+            if (len - 1 > MYNEWT_VAL(BLE_TRANSPORT_EVT_SIZE)) {
+                STATS_INC(hci_sock_stats, ierr);
+                dprintf(1, "Too big HCI event (%d > %d), ignoring\n", len - 1,
+                        MYNEWT_VAL(BLE_TRANSPORT_EVT_SIZE));
+                return -1;
+            }
+
             data = ble_transport_alloc_evt(0);
             if (!data) {
                 STATS_INC(hci_sock_stats, ierr);