From 04ee78248631e4ae2dc9b7088fee60c57515d3d1 Mon Sep 17 00:00:00 2001 From: Ryan Lortie Date: Wed, 8 Jan 2014 10:56:57 -0500 Subject: [PATCH] gdbus: properly escape introspection annotations Make sure we escape any special characters that are found in annotation names or values to avoid emitting a malformed XML document in response to an Introspect call. https://bugzilla.gnome.org/show_bug.cgi?id=721796 --- gio/gdbusintrospection.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/gio/gdbusintrospection.c b/gio/gdbusintrospection.c index c5f80ec..0b61275 100644 --- a/gio/gdbusintrospection.c +++ b/gio/gdbusintrospection.c @@ -583,12 +583,15 @@ g_dbus_annotation_info_generate_xml (GDBusAnnotationInfo *info, guint indent, GString *string_builder) { + gchar *tmp; guint n; - g_string_append_printf (string_builder, "%*skey, - info->value); + tmp = g_markup_printf_escaped ("%*skey, + info->value); + g_string_append (string_builder, tmp); + g_free (tmp); if (info->annotations == NULL) { -- 2.7.4