summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2016-05-13 01:41:26 +0200
committerBastien Nocera <hadess@hadess.net>2016-05-13 12:39:16 +0200
commitb338babb8e6aeb12dba14478780f250c6b9d66c2 (patch)
treefeda90c1022158ecfc2f714f1b52cfc5145a43fc
parentff0a1741225996b08472ef7ef4000f43288de7b6 (diff)
downloadbluez-tools-b338babb8e6aeb12dba14478780f250c6b9d66c2.tar.gz
bt-agent: Fix possible crasher when pin or passkey is requested
Both the RequestPinCode and RequestPasskey agent functions were using incorrect constructs to reply to bluetoothd. Fix those to fix a possible crash: Backtrace stopped: previous frame identical to this frame (corrupt stack?) #0 0xb6f618a4 in ?? () from /lib/arm-linux-gnueabihf/libglib-2.0.so.0 #1 0xb6f5d1b6 in g_variant_new_tuple () from /lib/arm-linux-gnueabihf/libglib-2.0.so.0 #2 0x00012fee in _bt_agent_method_call_func () #3 0xb6e998a8 in ?? () from /usr/lib/arm-linux-gnueabihf/libgio-2.0.so.0 Backtrace stopped: previous frame identical to this frame (corrupt stack?)
-rw-r--r--src/lib/agent-helper.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/lib/agent-helper.c b/src/lib/agent-helper.c
index cbd8b44..bf50bcc 100644
--- a/src/lib/agent-helper.c
+++ b/src/lib/agent-helper.c
@@ -300,9 +300,7 @@ static void _bt_agent_method_call_func(GDBusConnection *connection, const gchar
if (invoke)
{
- GVariant* vars[1];
- vars[0] = g_variant_new_uint32(ret);
- g_dbus_method_invocation_return_value(invocation, g_variant_new_tuple(vars, 1));
+ g_dbus_method_invocation_return_value(invocation, g_variant_new ("(u)", ret));
}
else
{
@@ -347,9 +345,7 @@ static void _bt_agent_method_call_func(GDBusConnection *connection, const gchar
if (invoke)
{
- GVariant* vars[1];
- vars[0] = g_variant_new_string(ret);
- g_dbus_method_invocation_return_value(invocation, g_variant_new_tuple(vars, 1));
+ g_dbus_method_invocation_return_value(invocation, g_variant_new ("(s)", ret));
}
else
{