From e97baaca22692ba78c82d699dd3057fa22e8eb2d Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Mon, 5 May 2014 16:03:57 +0300 Subject: [PATCH] audio/player: Fix accepting invalid folders in ChangeFolder When navigating on VFS ChangeFolder should only accept folders that are one level away for the current one as it does use ChangePath which can only navigate one level up/down in the virtual filesystem. --- profiles/audio/player.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/profiles/audio/player.c b/profiles/audio/player.c index 3cfe6795c..de608a3c9 100644 --- a/profiles/audio/player.c +++ b/profiles/audio/player.c @@ -1013,6 +1013,14 @@ static DBusMessage *media_folder_change_folder(DBusConnection *conn, return g_dbus_create_reply(msg, DBUS_TYPE_INVALID); } + /* + * ChangePath can only navigate one level up/down so check if folder + * is direct child or parent of the current folder otherwise fail. + */ + if (!g_slist_find(mp->folder->subfolders, folder) && + !g_slist_find(folder->subfolders, mp->folder)) + return btd_error_invalid_args(msg); + if (cb->cbs->change_folder == NULL) return btd_error_not_supported(msg); -- 2.47.3