Bluetooth: audio: pacs: Fix PACS notification

This fixes sending PACS notification with buffer containing invalid,
uninitialized data.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This commit is contained in:
Mariusz Skamra 2022-10-20 10:19:44 +02:00 committed by Carles Cufí
commit 8500eb1335

View file

@ -570,6 +570,8 @@ static void pac_notify(struct k_work *work)
#if defined(CONFIG_BT_PAC_SNK) #if defined(CONFIG_BT_PAC_SNK)
if (work == &snks_work.work) { if (work == &snks_work.work) {
get_pac_records(NULL, BT_AUDIO_DIR_SINK, &read_buf);
err = bt_gatt_notify_uuid(NULL, BT_UUID_PACS_SNK, err = bt_gatt_notify_uuid(NULL, BT_UUID_PACS_SNK,
pacs_svc.attrs, read_buf.data, pacs_svc.attrs, read_buf.data,
read_buf.len); read_buf.len);
@ -578,6 +580,8 @@ static void pac_notify(struct k_work *work)
#if defined(CONFIG_BT_PAC_SRC) #if defined(CONFIG_BT_PAC_SRC)
if (work == &srcs_work.work) { if (work == &srcs_work.work) {
get_pac_records(NULL, BT_AUDIO_DIR_SOURCE, &read_buf);
err = bt_gatt_notify_uuid(NULL, BT_UUID_PACS_SRC, err = bt_gatt_notify_uuid(NULL, BT_UUID_PACS_SRC,
pacs_svc.attrs, read_buf.data, pacs_svc.attrs, read_buf.data,
read_buf.len); read_buf.len);