File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
connectivity/FEATURE_BLE/libraries/cordio_stack/ble-host/sources/hci/dual_chip Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -1331,6 +1331,11 @@ static void hciEvtProcessLeExtAdvReport(uint8_t *p, uint8_t len)
13311331 while (i -- > 0 )
13321332 {
13331333 ptr += HCI_EXT_ADV_RPT_DATA_LEN_OFFSET ;
1334+ // discard event if it doesn't contain enough data
1335+ if (ptr >= p + len )
1336+ {
1337+ return ;
1338+ }
13341339 BSTREAM_TO_UINT8 (dataLen , ptr );
13351340 ptr += dataLen ;
13361341
@@ -1342,6 +1347,12 @@ static void hciEvtProcessLeExtAdvReport(uint8_t *p, uint8_t len)
13421347 }
13431348 }
13441349
1350+ // finally check that the last report is fully contained within the event
1351+ if (ptr > p + len )
1352+ {
1353+ return ;
1354+ }
1355+
13451356 /* allocate temp buffer that can hold max length ext adv/scan rsp data */
13461357 if ((pMsg = WsfBufAlloc (sizeof (hciLeExtAdvReportEvt_t ) + maxLen )) != NULL )
13471358 {
You can’t perform that action at this time.
0 commit comments