diff mbox series

[BlueZ,1/2] btio: Set correct length for getsockopt

Message ID 20250117140632.120501-2-iulia.tanasescu@nxp.com
State New
Headers show
Series [BlueZ,1/2] btio: Set correct length for getsockopt | expand

Commit Message

Iulia Tanasescu Jan. 17, 2025, 2:06 p.m. UTC
When calling getsockopt for BT_ISO_BASE, this initializes the length
argument to the maximum size of the buffer where the bytes are placed.

This fixes the fact that, on a Broadcast Sink, if the BASE discovered
from a Broadcast Source exceeds a certain length, the bytes will be
incompletely read, causing issues when parsing the LTVs.
---
 btio/btio.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/btio/btio.c b/btio/btio.c
index 2d277e409..f32fbd509 100644
--- a/btio/btio.c
+++ b/btio/btio.c
@@ -5,7 +5,7 @@ 
  *
  *  Copyright (C) 2009-2010  Marcel Holtmann <marcel@holtmann.org>
  *  Copyright (C) 2009-2010  Nokia Corporation
- *  Copyright 2023-2024 NXP
+ *  Copyright 2023-2025 NXP
  *
  *
  */
@@ -1654,6 +1654,7 @@  static gboolean iso_get(int sock, GError **err, BtIOOption opt1, va_list args)
 		return FALSE;
 	}
 
+	len = BASE_MAX_LENGTH;
 	if (getsockopt(sock, SOL_BLUETOOTH, BT_ISO_BASE,
 			&base.base, &len) < 0) {
 		ERROR_FAILED(err, "getsockopt(BT_ISO_BASE)", errno);