Linux bluetooth development
 help / color / mirror / Atom feed
* [BlueZ 1/2] mpris-proxy: Fix possible crash
@ 2026-05-05  7:29 Bastien Nocera
  2026-05-05  7:29 ` [BlueZ 2/2] mpris-proxy: Avoid session->obex dereference Bastien Nocera
  2026-05-05  9:18 ` [BlueZ,1/2] mpris-proxy: Fix possible crash bluez.test.bot
  0 siblings, 2 replies; 3+ messages in thread
From: Bastien Nocera @ 2026-05-05  7:29 UTC (permalink / raw)
  To: linux-bluetooth

find_player_by_obex() doesn't check whether session->obex is a valid
pointer before dereferecing it, but all code paths that assign it use
create_obex_session() to assign it, a function that can fail.

Check whether session->obex is null before dereferencing it.

 #0 find_player_by_obex at tools/mpris-proxy.c:2819
 #1 obex_property_changed at tools/mpris-proxy.c:2929
 #2 add_property at gdbus/client.c:373
 #3 update_properties at gdbus/client.c:399
 #5 properties_changed at gdbus/client.c:537
 #6 signal_filter at gdbus/watch.c:416
 #7 message_filter at gdbus/watch.c:566
 #10 message_dispatch at gdbus/mainloop.c:59
 #13 g_main_context_dispatch_unlocked at ../glib/gmain.c:4451
 #14 g_main_context_iterate_unlocked at ../glib/gmain.c:4516

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=2466640
---
 tools/mpris-proxy.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tools/mpris-proxy.c b/tools/mpris-proxy.c
index 1d7a421e9278..360b8ab34469 100644
--- a/tools/mpris-proxy.c
+++ b/tools/mpris-proxy.c
@@ -2816,8 +2816,12 @@ static struct player *find_player_by_obex(const char *path)
 	for (l = players; l; l = l->next) {
 		struct player *player = l->data;
 		struct obex_session *session = player->obex;
-		const char *obex_path = g_dbus_proxy_get_path(session->obex);
+		const char *obex_path = NULL;
 
+		if (session == NULL)
+			continue;
+
+		obex_path= g_dbus_proxy_get_path(session->obex);
 		if (g_str_has_prefix(path, obex_path))
 			return player;
 	}
-- 
2.54.0


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

end of thread, other threads:[~2026-05-05  9:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-05  7:29 [BlueZ 1/2] mpris-proxy: Fix possible crash Bastien Nocera
2026-05-05  7:29 ` [BlueZ 2/2] mpris-proxy: Avoid session->obex dereference Bastien Nocera
2026-05-05  9:18 ` [BlueZ,1/2] mpris-proxy: Fix possible crash 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