mesh: Fix possible NULL dereferences in client models

There's a small but real chance of a race-condition when sending
messages to the local node (through the local network interface) that
expected parameters will be NULL in the message handles. Add
appropriate NULL checks for them.
This commit is contained in:
Michał Narajowski
2018-04-10 12:32:26 +02:00
parent 0f7a7ccffc
commit 33142fe7f6
2 changed files with 12 additions and 4 deletions
+9 -3
View File
@@ -163,7 +163,9 @@ static void net_key_status(struct bt_mesh_model *model,
return;
}
*param->status = status;
if (param->status) {
*param->status = status;
}
k_sem_give(&cli->op_sync);
}
@@ -200,7 +202,9 @@ static void app_key_status(struct bt_mesh_model *model,
return;
}
*param->status = status;
if (param->status) {
*param->status = status;
}
k_sem_give(&cli->op_sync);
}
@@ -250,7 +254,9 @@ static void mod_app_status(struct bt_mesh_model *model,
return;
}
*param->status = status;
if (param->status) {
*param->status = status;
}
k_sem_give(&cli->op_sync);
}
+3 -1
View File
@@ -154,7 +154,9 @@ static void health_attention_status(struct bt_mesh_model *model,
param = health_cli->op_param;
*param->attention = net_buf_simple_pull_u8(buf);
if (param->attention) {
*param->attention = net_buf_simple_pull_u8(buf);
}
k_sem_give(&health_cli->op_sync);
}