fix(ble_mesh): fixed BLE-Mesh NimBLE extended-adv reassembly buffer overflow on COMPLETE fragment

(cherry picked from commit 1b22467f63)

Co-authored-by: luoxu <luoxu@espressif.com>
This commit is contained in:
Luo Xu
2026-07-06 17:43:54 +08:00
parent 2fed52c729
commit 6723edeb5c

View File

@@ -538,6 +538,10 @@ int disc_cb(struct ble_gap_event *event, void *arg)
switch (desc->data_status) {
case BLE_GAP_EXT_ADV_DATA_STATUS_COMPLETE:
if (adv_report_cache.adv_data_len) {
if (adv_report_cache.adv_data_len + desc->length_data > BLE_MESH_GAP_ADV_MAX_LEN) {
memset(&adv_report_cache, 0, sizeof(adv_report_cache));
return false;
}
memcpy(adv_report_cache.adv_data + adv_report_cache.adv_data_len,
desc->data, desc->length_data);
adv_report_cache.adv_data_len += desc->length_data;