Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH BlueZ] device: Fix NULL pointer dereference in dev_property_get_uuids
@ 2026-09-22  3:10 Tao Cai
  2026-09-22  6:58 ` [BlueZ] " bluez.test.bot
  2026-09-22 15:20 ` [PATCH BlueZ] " patchwork-bot+bluetooth
  0 siblings, 2 replies; 3+ messages in thread
From: Tao Cai @ 2026-09-22  3:10 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: marcel, luiz.dentz, Tao Cai

The bluetoothd process crashes during D-Bus property serialization when
the device UUID list contains a NULL entry. Add a NULL check before
calling dbus_message_iter_append_basic().

---
Crash Stack Trace (BlueZ 5.71 AArch64):
#0  0x0000ffff8ecfbe98 in ??? () at /lib/aarch64-linux-gnu/libc.so.6
#1  0x0000ffff8ecfe548 in ??? () at /lib/aarch64-linux-gnu/libc.so.6
#2  0x0000ffff8ecff120 in ??? () at /lib/aarch64-linux-gnu/libc.so.6
#3  0x0000ffff8ed005c8 in realloc () at /lib/aarch64-linux-gnu/libc.so.6
#4  0x0000ffff8f250204 in ??? () at /lib/aarch64-linux-gnu/libdbus-1.so.3
#5  0x0000ffff8f251c34 in _dbus_string_copy_len () at /lib/aarch64-linux-gnu/libdbus-1.so.3
#6  0x0000ffff8f254294 in ??? () at /lib/aarch64-linux-gnu/libdbus-1.so.3
#7  0x0000ffff8f23f968 in _dbus_type_writer_write_basic () at /lib/aarch64-linux-gnu/libdbus-1.so.3
#8  0x0000ffff8f243208 in dbus_message_iter_append_basic () at /lib/aarch64-linux-gnu/libdbus-1.so.3
#9  0x0000aaaabe2f64d0 in dev_property_get_uuids (property=<optimized out>, iter=0xffffd510cf28, data=0xaaaac18514e0) at src/device.c:1339
...
#21 main (argc=<optimized out>, argv=<optimized out>) at src/main.c:1456
---
 src/device.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/device.c b/src/device.c
index 6d82ea3e2..c5d8e4c6e 100644
--- a/src/device.c
+++ b/src/device.c
@@ -1455,9 +1455,13 @@ static gboolean dev_property_get_uuids(const GDBusPropertyTable *property,
 	else
 		l = dev->uuids;
 
-	for (; l != NULL; l = l->next)
-		dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING,
-							&l->data);
+	for (; l != NULL; l = l->next) {
+		const char *uuid = l->data;
+		if (uuid != NULL) {
+			dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING,
+							&uuid);
+		}
+	}
 
 	dbus_message_iter_close_container(iter, &entry);
 
-- 
2.43.0


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

end of thread, other threads:[~2026-09-22 15:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-22  3:10 [PATCH BlueZ] device: Fix NULL pointer dereference in dev_property_get_uuids Tao Cai
2026-09-22  6:58 ` [BlueZ] " bluez.test.bot
2026-09-22 15:20 ` [PATCH BlueZ] " patchwork-bot+bluetooth

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