mirror of https://github.com/ARMmbed/mbed-os.git
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
parent
7d99fd10c4
commit
2692df35db
|
@ -170,9 +170,18 @@ void hciTrSerialRxIncoming(uint8_t *pBuf, uint8_t len)
|
||||||
hdrLen = HCI_EVT_HDR_LEN;
|
hdrLen = HCI_EVT_HDR_LEN;
|
||||||
break;
|
break;
|
||||||
default:
|
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);
|
WSF_ASSERT(0);
|
||||||
break;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* see if entire header has been read */
|
/* see if entire header has been read */
|
||||||
|
|
Loading…
Reference in New Issue