From f9e291cc87aa7a84bbc01d5f2e9ecad703e79977 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Narajowski?= Date: Tue, 10 Apr 2018 11:51:48 +0200 Subject: [PATCH] mesh: cfg_cli: Fix trying to write a NULL pointer It's not always guaranteed that param->status will be non-NULL, especially not after a subsequent patch to fix a race condition with the response waiting. --- nimble/host/mesh/src/cfg_cli.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/nimble/host/mesh/src/cfg_cli.c b/nimble/host/mesh/src/cfg_cli.c index a6112cf83..49c0a4160 100644 --- a/nimble/host/mesh/src/cfg_cli.c +++ b/nimble/host/mesh/src/cfg_cli.c @@ -313,7 +313,9 @@ static void mod_pub_status(struct bt_mesh_model *model, return; } - *param->status = status; + if (param->status) { + *param->status = status; + } if (param->pub) { param->pub->addr = net_buf_simple_pull_le16(buf); @@ -378,7 +380,9 @@ static void mod_sub_status(struct bt_mesh_model *model, *param->sub_addr = sub_addr; } - *param->status = status; + if (param->status) { + *param->status = status; + } k_sem_give(&cli->op_sync); }