Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH BlueZ] advertising: Allow ServiceData with no data
@ 2026-11-24 13:31 Simon Mikuda
  2026-11-24 20:30 ` [BlueZ] " bluez.test.bot
  0 siblings, 1 reply; 2+ messages in thread
From: Simon Mikuda @ 2026-11-24 13:31 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Simon Mikuda

A ServiceData entry with an empty value is rejected and the whole
advertisement fails to register, as the byte type is checked on the
first element of the array, which an empty array does not have. A
Service Data AD with only the UUID is valid, and a Scan Delegator
advertises the BASS UUID like that.

Check the element type of the array instead.

Steps to reproduce:

  [bluetoothctl]> advertise.service 0x184f
  [bluetoothctl]> advertise on
  Failed to register advertisement: org.bluez.Error.Failed

Fixes: 758dae03725e ("core/advertising: Fix not parsing data properly")
Assisted-by: Claude:claude-opus-5-5
---
 src/advertising.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/advertising.c b/src/advertising.c
index d07068c6c..3a1d9a6b7 100644
--- a/src/advertising.c
+++ b/src/advertising.c
@@ -489,11 +489,11 @@ static bool parse_service_data(DBusMessageIter *iter, struct bt_ad *ad)
 		if (dbus_message_iter_get_arg_type(&value) != DBUS_TYPE_ARRAY)
 			goto fail;
 
-		dbus_message_iter_recurse(&value, &array);
-
-		if (dbus_message_iter_get_arg_type(&array) != DBUS_TYPE_BYTE)
+		if (dbus_message_iter_get_element_type(&value) !=
+							DBUS_TYPE_BYTE)
 			goto fail;
 
+		dbus_message_iter_recurse(&value, &array);
 		dbus_message_iter_get_fixed_array(&array, &service_data, &len);
 
 		DBG("Adding ServiceData for %s", uuid_str);

base-commit: 1608f836188610aabeff5a3164169ebe0360e443
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-24 20:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-24 13:31 [PATCH BlueZ] advertising: Allow ServiceData with no data Simon Mikuda
2026-11-24 20:30 ` [BlueZ] " bluez.test.bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox