Skip to content

Commit

Permalink
Set the stateRx variable to HCI_RX_STATE_IDLE when an invalid HCI pac…
Browse files Browse the repository at this point in the history
…ket type is detected, to prevent overflow in the hdrRx buffer.
  • Loading branch information
Chris Snow authored and Chris Snow committed Oct 16, 2024
1 parent b2d11fc commit 0b8cb90
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions connectivity/FEATURE_BLE/source/cordio/stack_adaptation/hci_tr.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,18 @@ void hciTrSerialRxIncoming(uint8_t *pBuf, uint8_t len)
hdrLen = HCI_EVT_HDR_LEN;
break;
default:
/* invalid packet type */
/**
* invalid packet type
*
* fix: Simply employing WSF_ASSERT in the event of
* an "invalid packet type" is not reasonable.
* Instead, it is advisable to discard this data packet,
* exit the packet processing function,
* and adjust the stateRx back to HCI_RX_STATE_IDLE.
*/
stateRx = HCI_RX_STATE_IDLE;
WSF_ASSERT(0);
break;
return;
}

/* see if entire header has been read */
Expand Down

0 comments on commit 0b8cb90

Please sign in to comment.