Skip to content

Commit 8974db5

Browse files
authored
Cordio BLE: Fix two integer overflows (CVE-2024-48982) (#386)
* Cordio BLE: Fix two integer overflows * Cordio BLE: Fix sign in length check
1 parent 92df629 commit 8974db5

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
@@ -2482,6 +2482,11 @@ void hciEvtProcessCmdCmpl(uint8_t *p, uint8_t len)
24822482
uint8_t cbackEvt = 0;
24832483
hciEvtCback_t cback = hciCb.evtCback;
24842484

2485+
if (len < 3)
2486+
{
2487+
return;
2488+
}
2489+
24852490
BSTREAM_TO_UINT8(numPkts, p);
24862491
BSTREAM_TO_UINT16(opcode, p);
24872492

@@ -2695,7 +2700,7 @@ void hciEvtProcessCmdCmpl(uint8_t *p, uint8_t len)
26952700
if (cbackEvt == HCI_UNHANDLED_CMD_CMPL_CBACK_EVT) {
26962701
const uint8_t structSize = sizeof(hciUnhandledCmdCmplEvt_t) - 1 /* removing the fake 1-byte array */;
26972702
const uint8_t remainingLen = len - 3 /* we already read opcode and numPkts */;
2698-
const uint8_t msgSize = structSize + remainingLen;
2703+
const uint16_t msgSize = structSize + remainingLen;
26992704

27002705
pMsg = WsfBufAlloc(msgSize);
27012706
if (pMsg != NULL) {

0 commit comments

Comments
 (0)