mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-01 18:50:34 +03:00
Merge branch 'bugfix/ble_enhanced_security_v2_v5.5' into 'release/v5.5'
fix(ble/bluedroid): Fixed potential out-of-bounds memory access when resolve adv data (v5.5) See merge request espressif/esp-idf!41307
This commit is contained in:
@@ -2071,6 +2071,13 @@ UINT8 *BTM_CheckAdvData( UINT8 *p_adv, UINT16 adv_data_len, UINT8 type, UINT8 *p
|
||||
STREAM_TO_UINT8(adv_type, p);
|
||||
|
||||
if ( adv_type == type ) {
|
||||
|
||||
if((p + length - 1) > (p_adv + adv_data_len)) {
|
||||
/* avoid memory overflow*/
|
||||
*p_length = 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* length doesn't include itself */
|
||||
*p_length = length - 1; /* minus the length of type */
|
||||
return p;
|
||||
|
||||
Reference in New Issue
Block a user