Skip to contentSkip to conversation

Fix proper data escaping for vCard listing

PATCH Applied Bartosz Szatkowski 2 participants 2 messages Jul 21, 2011 – Jul 26, 2011 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix proper data escaping for vCard listing

Up until now it was possible to inject some XML or just broke returned vCard listing by preparing contact with some special characters.

---
 plugins/pbap.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
plugins/pbap.c +4 -1
index 5455cce..82963af 100644
@@ -469,9 +469,12 @@ static int generate_response(void *user_data)
 	pbap->obj->buffer = g_string_new(VCARD_LISTING_BEGIN);
 	for (; l && max; l = l->next, max--) {
 		const struct cache_entry *entry = l->data;
+		char *escaped_name = g_markup_escape_text(entry->name, -1);
 
 		g_string_append_printf(pbap->obj->buffer,
-			VCARD_LISTING_ELEMENT, entry->handle, entry->name);
+			VCARD_LISTING_ELEMENT, entry->handle, escaped_name);
+
+		g_free(escaped_name);
 	}
 
 	pbap->obj->buffer = g_string_append(pbap->obj->buffer,
Signature · 1 line
1.7.4.1
#1 lore raw

Hi Bartosz,

Quoted 5 lines · Bartosz Szatkowski

Up until now it was possible to inject some XML or just broke returned vCard listing by preparing contact with some special characters.

---
 plugins/pbap.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

Applied. Thanks.

Johan