bluetooth: mesh: Don't write to const value

`bt_mesh_default_key` is declared as const and thus located in flash.
`bt_mesh_cdb_subnet_key_export` tries to copy to that address which
results in a Bus Fault.

Use separate array for storing net_key.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
This commit is contained in:
Pavel Vasilyev 2023-11-10 14:50:41 +01:00 committed by Carles Cufí
commit 64e1d0c3be

View file

@ -944,7 +944,7 @@ static int cmd_provision_adv(const struct shell *sh, size_t argc,
static int cmd_provision_local(const struct shell *sh, size_t argc, char *argv[])
{
uint8_t *net_key = (uint8_t *)bt_mesh_shell_default_key;
uint8_t net_key[16];
uint16_t net_idx, addr;
uint32_t iv_index;
int err = 0;
@ -963,6 +963,8 @@ static int cmd_provision_local(const struct shell *sh, size_t argc, char *argv[]
return err;
}
memcpy(net_key, bt_mesh_shell_default_key, sizeof(net_key));
if (IS_ENABLED(CONFIG_BT_MESH_CDB)) {
struct bt_mesh_cdb_subnet *sub;