|
@@ -231,7 +231,6 @@ void bt_mesh_time_scene_client_cb_evt_to_btc(u32_t opcode, u8_t evt_type,
|
|
|
{
|
|
{
|
|
|
esp_ble_mesh_time_scene_client_cb_param_t cb_params = {0};
|
|
esp_ble_mesh_time_scene_client_cb_param_t cb_params = {0};
|
|
|
esp_ble_mesh_client_common_param_t params = {0};
|
|
esp_ble_mesh_client_common_param_t params = {0};
|
|
|
- size_t length = 0U;
|
|
|
|
|
uint8_t act = 0U;
|
|
uint8_t act = 0U;
|
|
|
|
|
|
|
|
if (!model || !ctx) {
|
|
if (!model || !ctx) {
|
|
@@ -272,8 +271,7 @@ void bt_mesh_time_scene_client_cb_evt_to_btc(u32_t opcode, u8_t evt_type,
|
|
|
cb_params.params = ¶ms;
|
|
cb_params.params = ¶ms;
|
|
|
|
|
|
|
|
if (val && len) {
|
|
if (val && len) {
|
|
|
- length = (len <= sizeof(cb_params.status_cb)) ? len : sizeof(cb_params.status_cb);
|
|
|
|
|
- memcpy(&cb_params.status_cb, val, length);
|
|
|
|
|
|
|
+ memcpy(&cb_params.status_cb, val, MIN(len, sizeof(cb_params.status_cb)));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
btc_ble_mesh_time_scene_client_callback(&cb_params, act);
|
|
btc_ble_mesh_time_scene_client_callback(&cb_params, act);
|
|
@@ -413,7 +411,6 @@ void bt_mesh_time_scene_server_cb_evt_to_btc(u8_t evt_type, struct bt_mesh_model
|
|
|
const u8_t *val, size_t len)
|
|
const u8_t *val, size_t len)
|
|
|
{
|
|
{
|
|
|
esp_ble_mesh_time_scene_server_cb_param_t cb_params = {0};
|
|
esp_ble_mesh_time_scene_server_cb_param_t cb_params = {0};
|
|
|
- size_t length = 0U;
|
|
|
|
|
uint8_t act = 0U;
|
|
uint8_t act = 0U;
|
|
|
|
|
|
|
|
if (model == NULL || ctx == NULL) {
|
|
if (model == NULL || ctx == NULL) {
|
|
@@ -450,8 +447,7 @@ void bt_mesh_time_scene_server_cb_evt_to_btc(u8_t evt_type, struct bt_mesh_model
|
|
|
cb_params.ctx.send_ttl = ctx->send_ttl;
|
|
cb_params.ctx.send_ttl = ctx->send_ttl;
|
|
|
|
|
|
|
|
if (val && len) {
|
|
if (val && len) {
|
|
|
- length = (len <= sizeof(cb_params.value)) ? len : sizeof(cb_params.value);
|
|
|
|
|
- memcpy(&cb_params.value, val, length);
|
|
|
|
|
|
|
+ memcpy(&cb_params.value, val, MIN(len, sizeof(cb_params.value)));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
btc_ble_mesh_time_scene_server_callback(&cb_params, act);
|
|
btc_ble_mesh_time_scene_server_callback(&cb_params, act);
|