mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-30 10:47:19 +02:00
fix(ble_mesh): fixed proxy server might send segment message with incorrect format
refer commit: 7738bca124
This commit is contained in:
@ -1341,7 +1341,7 @@ int bt_mesh_proxy_server_segment_send(struct bt_mesh_conn *conn, uint8_t type,
|
|||||||
net_buf_simple_pull(msg, mtu);
|
net_buf_simple_pull(msg, mtu);
|
||||||
|
|
||||||
while (msg->len) {
|
while (msg->len) {
|
||||||
if (msg->len + 1 < mtu) {
|
if (msg->len + 1 <= mtu) {
|
||||||
net_buf_simple_push_u8(msg, BLE_MESH_PROXY_PDU_HDR(BLE_MESH_PROXY_SAR_LAST, type));
|
net_buf_simple_push_u8(msg, BLE_MESH_PROXY_PDU_HDR(BLE_MESH_PROXY_SAR_LAST, type));
|
||||||
proxy_send(conn, msg->data, msg->len);
|
proxy_send(conn, msg->data, msg->len);
|
||||||
break;
|
break;
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2017 Intel Corporation
|
* SPDX-FileCopyrightText: 2017 Intel Corporation
|
||||||
* SPDX-FileContributor: 2020-2024 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileContributor: 2020-2025 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@ -86,13 +86,14 @@ int bt_mesh_unprov_dev_info_query(uint8_t uuid[16], uint8_t addr[6],
|
|||||||
{
|
{
|
||||||
uint8_t idx = 0;
|
uint8_t idx = 0;
|
||||||
uint8_t cnt = 0;
|
uint8_t cnt = 0;
|
||||||
|
uint8_t pair_num = unprov_dev_info_fifo.pair_num;
|
||||||
|
|
||||||
if (uuid == NULL || addr == NULL) {
|
if (uuid == NULL && addr == NULL) {
|
||||||
BT_WARN("No available information to query");
|
BT_WARN("No available information to query");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (cnt < unprov_dev_info_fifo.pair_num) {
|
while (cnt < pair_num) {
|
||||||
idx = (cnt + unprov_dev_info_fifo.start_idx) % BLE_MESH_STORE_UNPROV_INFO_MAX_NUM;
|
idx = (cnt + unprov_dev_info_fifo.start_idx) % BLE_MESH_STORE_UNPROV_INFO_MAX_NUM;
|
||||||
if (query_type & BLE_MESH_STORE_UNPROV_INFO_QUERY_TYPE_UUID) {
|
if (query_type & BLE_MESH_STORE_UNPROV_INFO_QUERY_TYPE_UUID) {
|
||||||
if (!memcmp(unprov_dev_info_fifo.info[idx].addr, addr, 6)) {
|
if (!memcmp(unprov_dev_info_fifo.info[idx].addr, addr, 6)) {
|
||||||
@ -118,7 +119,7 @@ int bt_mesh_unprov_dev_info_query(uint8_t uuid[16], uint8_t addr[6],
|
|||||||
cnt++;
|
cnt++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cnt == unprov_dev_info_fifo.pair_num) {
|
if (cnt == pair_num) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user