All of lore.kernel.org
 help / color / mirror / Atom feed
* Fix crash when incorrect reply is received from SelectConfiguration
@ 2015-11-24 16:01 Michal Suchanek
  0 siblings, 0 replies; only message in thread
From: Michal Suchanek @ 2015-11-24 16:01 UTC (permalink / raw)
  To: linux-bluetooth

There is no check that SelectConfiguration call on MediaEndpoint1
returns an array before accessing the array. When the return from
SelectConfiguration is not an array type bluetoothd crashes.

Ignore the reply in that case.
---
 profiles/audio/media.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/profiles/audio/media.c b/profiles/audio/media.c
index 69070bf..a5cb490 100644
--- a/profiles/audio/media.c
+++ b/profiles/audio/media.c
@@ -292,6 +292,12 @@ static void endpoint_reply(DBusPendingCall *call, void *user_data)
 
 		dbus_message_iter_init(reply, &args);
 
+		if (dbus_message_iter_get_arg_type(&args) != DBUS_TYPE_ARRAY) {
+			error("SelectConfiguration did not return an array: %s",
+				dbus_message_get_signature(reply));
+			goto done;
+		}
+
 		dbus_message_iter_recurse(&args, &array);
 
 		dbus_message_iter_get_fixed_array(&array, &configuration, &size);
-- 
2.6.2


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2015-11-24 16:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-24 16:01 Fix crash when incorrect reply is received from SelectConfiguration Michal Suchanek

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.