diff mbox series

[BlueZ,v3,2/7] btdev: Check for valid SID on BT_HCI_CMD_LE_PA_CREATE_SYNC

Message ID 20250416160433.1822263-2-luiz.dentz@gmail.com
State New
Headers show
Series [BlueZ,v3,1/7] bap: Fix not setting SID for broadcast receiver | expand

Commit Message

Luiz Augusto von Dentz April 16, 2025, 4:04 p.m. UTC
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

---
 emulator/btdev.c | 6 ++++++
 1 file changed, 6 insertions(+)
diff mbox series

Patch

diff --git a/emulator/btdev.c b/emulator/btdev.c
index 7e4cb9393593..a1c82ae306d7 100644
--- a/emulator/btdev.c
+++ b/emulator/btdev.c
@@ -5728,6 +5728,12 @@  static int cmd_pa_create_sync(struct btdev *dev, const void *data, uint8_t len)
 	uint8_t status = BT_HCI_ERR_SUCCESS;
 	struct le_per_adv *per_adv;
 
+	if (cmd->sid > 0x0f) {
+		cmd_status(dev, BT_HCI_ERR_INVALID_PARAMETERS,
+			   BT_HCI_CMD_LE_PA_CREATE_SYNC);
+		return 0;
+	}
+
 	/* Create new train */
 	per_adv = le_per_adv_new(dev, cmd->addr_type, cmd->addr);
 	if (!per_adv)