diff --git a/subsys/bluetooth/mesh/shell/shell.c b/subsys/bluetooth/mesh/shell/shell.c index 6ee825d4c09..c1bad5d24ad 100644 --- a/subsys/bluetooth/mesh/shell/shell.c +++ b/subsys/bluetooth/mesh/shell/shell.c @@ -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;