From 07e8e726758fd957df3a1c04223c6454d1a2573e Mon Sep 17 00:00:00 2001 From: Iulia Tanasescu Date: Fri, 17 Jan 2025 16:06:31 +0200 Subject: [PATCH] btio: Set correct length for getsockopt 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 --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 * 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); -- 2.47.3