From cc74ac4d54ad7b13e7138f75e4ef1f3d38fcd9d5 Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Mon, 19 Jul 2010 12:24:23 +0200 Subject: [PATCH] Handle failure to hex encode in handle_server_data_anonymous_mech --- dbus/dbus-auth.c | 17 +++++++++++------ 1 files changed, 11 insertions(+), 6 deletions(-) diff --git a/dbus/dbus-auth.c b/dbus/dbus-auth.c index 3173f34..7597f3f 100644 --- a/dbus/dbus-auth.c +++ b/dbus/dbus-auth.c @@ -1207,12 +1207,17 @@ handle_server_data_anonymous_mech (DBusAuth *auth, DBusString plaintext; DBusString encoded; _dbus_string_init_const (&plaintext, "D-Bus " DBUS_VERSION_STRING); - _dbus_string_init (&encoded); - _dbus_string_hex_encode (&plaintext, 0, - &encoded, - 0); - _dbus_verbose ("%s: try '%s'\n", - DBUS_AUTH_NAME (auth), _dbus_string_get_const_data (&encoded)); + if (_dbus_string_init (&encoded)) + { + _dbus_string_hex_encode (&plaintext, 0, &encoded, 0); + _dbus_verbose ("%s: try '%s'\n", + DBUS_AUTH_NAME (auth), + _dbus_string_get_const_data (&encoded)); + _dbus_string_free (&encoded); + } + else + _dbus_verbose ("%s: try ''\n", + DBUS_AUTH_NAME (auth)); } return send_rejected (auth); } -- 1.7.3.1