linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bartosz Szatkowski <bulislaw@linux.com>
To: linux-bluetooth@vger.kernel.org
Cc: Bartosz Szatkowski <bulislaw@linux.com>
Subject: [PATCH obexd] Fix proper data escaping for vCard listing
Date: Thu, 21 Jul 2011 15:55:07 +0200	[thread overview]
Message-ID: <1311256507-10744-1-git-send-email-bulislaw@linux.com> (raw)

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(-)

diff --git a/plugins/pbap.c b/plugins/pbap.c
index 5455cce..82963af 100644
--- a/plugins/pbap.c
+++ b/plugins/pbap.c
@@ -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,
-- 
1.7.4.1


             reply	other threads:[~2011-07-21 13:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-21 13:55 Bartosz Szatkowski [this message]
2011-07-26 10:38 ` [PATCH obexd] Fix proper data escaping for vCard listing Johan Hedberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1311256507-10744-1-git-send-email-bulislaw@linux.com \
    --to=bulislaw@linux.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).