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. (#374)

Co-authored-by: Chris Snow <[email protected]>
  • Loading branch information
chrissnow and Chris Snow authored Oct 17, 2024
1 parent 7d99fd1 commit 2692df3
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 2692df3

Please sign in to comment.