g_dbus_error_encode_gerror: don't segfault on bad domains

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Matthias Clasen <mclasen@redhat.com>
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=660371
This commit is contained in:
Simon McVittie 2011-09-29 13:57:09 +01:00
parent 5156d1b2d4
commit e60e4999b9

View File

@ -837,6 +837,10 @@ g_dbus_error_encode_gerror (const GError *error)
* hex-encode it for transport across the wire.
*/
domain_as_string = g_quark_to_string (error->domain);
/* 0 is not a domain; neither are non-quark integers */
g_return_val_if_fail (domain_as_string != NULL, NULL);
s = g_string_new ("org.gtk.GDBus.UnmappedGError.Quark._");
for (n = 0; domain_as_string[n] != 0; n++)
{