Bluetooth: 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. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
parent
7d301cbb6c
commit
b8042ea9ce
2 changed files with 12 additions and 4 deletions
|
@ -168,7 +168,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);
|
||||
}
|
||||
|
@ -205,7 +207,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);
|
||||
}
|
||||
|
@ -255,7 +259,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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue