From 7f20132c5494a6e8398a77d7429b5e5a4e0a2494 Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Wed, 13 Apr 2016 16:29:35 +0300 Subject: [PATCH] audio/media: Fix return NULL to .get_name Player need to have a name set otherwise it may cause the following crash: Invalid read of size 1 at 0x4826BD8: strlen (mc_replace_strmem.c:404) by 0x138289: avrcp_handle_get_folder_items (in /usr/libexec/bluetooth/bluetoothd) by 0x13A278: handle_browsing_pdu (in /usr/libexec/bluetooth/bluetoothd) by 0x1315F2: session_browsing_cb (in /usr/libexec/bluetooth/bluetoothd) by 0x48C69BB: g_io_unix_dispatch (in /usr/lib/libglib-2.0.so.0.3600.0) by 0x487FB2A: g_main_context_dispatch (in /usr/lib/libglib-2.0.so.0.3600.0) by 0x487FEB7: g_main_context_iterate.clone.5 (in /usr/lib/libglib-2.0.so.0.3600.0) by 0x48803AA: g_main_loop_run (in /usr/lib/libglib-2.0.so.0.3600.0) by 0x16D008: main (in /usr/libexec/bluetooth/bluetoothd) Address 0x0 is not stack'd, malloc'd or (recently) free'd --- profiles/audio/media.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/profiles/audio/media.c b/profiles/audio/media.c index 69070bf43..23d15611b 100644 --- a/profiles/audio/media.c +++ b/profiles/audio/media.c @@ -1018,6 +1018,9 @@ static const char *get_player_name(void *user_data) { struct media_player *mp = user_data; + if (!mp->name) + return "Player"; + return mp->name; } -- 2.47.3