From e5f496149ee37ca5a77ccead844dd4ceb3ef999c Mon Sep 17 00:00:00 2001 From: wangjialiang Date: Thu, 15 Apr 2021 22:36:45 +0800 Subject: [PATCH] ble_mesh: stack: Fix endianness error in output or input oob data of number Closes https://github.com/espressif/esp-idf/issues/6862 --- components/bt/esp_ble_mesh/mesh_core/provisioner_prov.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/bt/esp_ble_mesh/mesh_core/provisioner_prov.c b/components/bt/esp_ble_mesh/mesh_core/provisioner_prov.c index fc4fcf8095..71ec635a7a 100644 --- a/components/bt/esp_ble_mesh/mesh_core/provisioner_prov.c +++ b/components/bt/esp_ble_mesh/mesh_core/provisioner_prov.c @@ -2065,7 +2065,7 @@ int bt_mesh_provisioner_set_oob_input_data(const u8_t idx, const u8_t *val, bool memset(link[idx].auth, 0, 16); if (num_flag) { /* Provisioner inputs number */ - memcpy(link[idx].auth + 12, val, sizeof(u32_t)); + sys_memcpy_swap(link[idx].auth + 12, val, sizeof(uint32_t)); } else { /* Provisioner inputs string */ memcpy(link[idx].auth, val, link[idx].auth_size); @@ -2102,7 +2102,7 @@ int bt_mesh_provisioner_set_oob_output_data(const u8_t idx, const u8_t *num, if (num_flag) { /* Provisioner output number */ memset(link[idx].auth, 0, 16); - memcpy(link[idx].auth + 16 - size, num, size); + sys_memcpy_swap(link[idx].auth + 16 - size, num, size); } else { /* Provisioner output string */ memset(link[idx].auth, 0, 16);