fix(ble_mesh): fixed proxy server might send segment message with incorrect format

refer commit: 7738bca124
This commit is contained in:
luoxu
2025-06-06 14:28:19 +08:00
parent eb5c41678f
commit 3fd78bf329
2 changed files with 6 additions and 5 deletions

View File

@ -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);
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));
proxy_send(conn, msg->data, msg->len);
break;

View File

@ -2,7 +2,7 @@
/*
* 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
*/
@ -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 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");
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;
if (query_type & BLE_MESH_STORE_UNPROV_INFO_QUERY_TYPE_UUID) {
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++;
}
if (cnt == unprov_dev_info_fifo.pair_num) {
if (cnt == pair_num) {
return -1;
}