Set the stateRx variable to HCI_RX_STATE_IDLE when an invalid HCI packet type is detected, to prevent overflow in the hdrRx buffer. (#374)

Co-authored-by: Chris Snow <Chris.Snow@smartsentry.co.uk>
pull/15530/head
Chris Snow 2024-10-17 17:35:42 +01:00 committed by GitHub
parent 7d99fd10c4
commit 2692df35db
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 11 additions and 2 deletions

View File

@ -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 */