Bluetooth: has: Fix missing preset lookup call
Fixes null-pointer dereference. Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This commit is contained in:
parent
2d88e3934f
commit
8537e28f66
1 changed files with 10 additions and 0 deletions
|
@ -840,6 +840,11 @@ int bt_has_preset_available(uint8_t index)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
preset_foreach(index, index, preset_found, &preset);
|
||||
if (preset == NULL) {
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
/* toggle property bit if needed */
|
||||
if (!(preset->properties & BT_HAS_PROP_AVAILABLE)) {
|
||||
NET_BUF_SIMPLE_DEFINE(buf, sizeof(struct bt_has_cp_hdr) +
|
||||
|
@ -865,6 +870,11 @@ int bt_has_preset_unavailable(uint8_t index)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
preset_foreach(index, index, preset_found, &preset);
|
||||
if (preset == NULL) {
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
/* toggle property bit if needed */
|
||||
if (preset->properties & BT_HAS_PROP_AVAILABLE) {
|
||||
NET_BUF_SIMPLE_DEFINE(buf, sizeof(struct bt_has_cp_hdr) +
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue