mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-26 07:26:15 +01:00
gdbusauth: fix crash when server data send returns NULL
_g_dbus_auth_mechanism_server_data_send may fail in which case we would endup getting a NULL data. In this case we should not try to encode the data and simply let the state machine to continue. The auth mechanism will change internally to REJECTED so we just need to continue the iteration. https://bugzilla.gnome.org/show_bug.cgi?id=775309
This commit is contained in:
parent
93179f10b8
commit
463a863605
@ -1207,19 +1207,25 @@ _g_dbus_auth_run_server (GDBusAuth *auth,
|
||||
{
|
||||
gchar *data;
|
||||
gsize data_len;
|
||||
gchar *encoded_data;
|
||||
|
||||
data = _g_dbus_auth_mechanism_server_data_send (mech, &data_len);
|
||||
encoded_data = hexencode (data);
|
||||
s = g_strdup_printf ("DATA %s\r\n", encoded_data);
|
||||
g_free (encoded_data);
|
||||
g_free (data);
|
||||
debug_print ("SERVER: writing '%s'", s);
|
||||
if (!g_data_output_stream_put_string (dos, s, cancellable, error))
|
||||
if (data != NULL)
|
||||
{
|
||||
gchar *encoded_data;
|
||||
|
||||
encoded_data = hexencode (data);
|
||||
s = g_strdup_printf ("DATA %s\r\n", encoded_data);
|
||||
g_free (encoded_data);
|
||||
g_free (data);
|
||||
|
||||
debug_print ("SERVER: writing '%s'", s);
|
||||
if (!g_data_output_stream_put_string (dos, s, cancellable, error))
|
||||
{
|
||||
g_free (s);
|
||||
goto out;
|
||||
}
|
||||
g_free (s);
|
||||
goto out;
|
||||
}
|
||||
g_free (s);
|
||||
}
|
||||
goto change_state;
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user