From: Vinicius Costa Gomes <[email protected]>
This patch checks if the codec array included in the "Register" method
contains valid codec ID's.
---
plugins/hfp_audio.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/plugins/hfp_audio.c b/plugins/hfp_audio.c
index 7b334e2..db21a5d 100644
--- a/plugins/hfp_audio.c
+++ b/plugins/hfp_audio.c
@@ -35,6 +35,12 @@
#define HFP_AUDIO_MANAGER_INTERFACE OFONO_SERVICE
".HandsfreeAudioManager"
+/* Supported agents codecs */
+enum hfp_codec {
+ HFP_CODEC_CVSD = 0x01,
+ HFP_CODEC_MSBC = 0x02,
+};
+
static DBusMessage *am_get_cards(DBusConnection *conn,
DBusMessage *msg, void *user_data)
{
@@ -49,7 +55,7 @@ static DBusMessage *am_agent_register(DBusConnection *conn,
const char *path;
unsigned char *codecs;
DBusMessageIter iter, array;
- int length;
+ int length, i;
if (dbus_message_iter_init(msg, &iter) == FALSE)
goto invalid_args;
@@ -63,6 +69,12 @@ static DBusMessage *am_agent_register(DBusConnection *conn,
if (length == 0)
goto invalid_args;
+ for (i = 0; i < length; i++) {
+ if (codecs[i] != HFP_CODEC_CVSD &&
+ codecs[i] != HFP_CODEC_MSBC)
+ goto invalid_args;
+ }
+
return dbus_message_new_method_return(msg);
invalid_args:
--
1.7.11.7
_______________________________________________
ofono mailing list
[email protected]
http://lists.ofono.org/listinfo/ofono