Skip to content

Commit 0c2414e

Browse files
committed
Cordio BLE: Fix two integer overflows
1 parent cda8a9d commit 0c2414e

File tree

1 file changed

+6
-1
lines changed
  • connectivity/FEATURE_BLE/libraries/cordio_stack/ble-host/sources/hci/dual_chip

1 file changed

+6
-1
lines changed

connectivity/FEATURE_BLE/libraries/cordio_stack/ble-host/sources/hci/dual_chip/hci_evt.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2471,6 +2471,11 @@ void hciEvtProcessCmdCmpl(uint8_t *p, uint8_t len)
24712471
uint8_t cbackEvt = 0;
24722472
hciEvtCback_t cback = hciCb.evtCback;
24732473

2474+
if (len > 3)
2475+
{
2476+
return;
2477+
}
2478+
24742479
BSTREAM_TO_UINT8(numPkts, p);
24752480
BSTREAM_TO_UINT16(opcode, p);
24762481

@@ -2684,7 +2689,7 @@ void hciEvtProcessCmdCmpl(uint8_t *p, uint8_t len)
26842689
if (cbackEvt == HCI_UNHANDLED_CMD_CMPL_CBACK_EVT) {
26852690
const uint8_t structSize = sizeof(hciUnhandledCmdCmplEvt_t) - 1 /* removing the fake 1-byte array */;
26862691
const uint8_t remainingLen = len - 3 /* we already read opcode and numPkts */;
2687-
const uint8_t msgSize = structSize + remainingLen;
2692+
const uint16_t msgSize = structSize + remainingLen;
26882693

26892694
pMsg = WsfBufAlloc(msgSize);
26902695
if (pMsg != NULL) {

0 commit comments

Comments
 (0)