From 17744fc81d371f6f0d23d19f6efbc68a45c19ede Mon Sep 17 00:00:00 2001 From: Pierre Habouzit Date: Mon, 23 Jun 2008 18:43:32 +0200 Subject: [PATCH] Be more on the safe side. it's useless to escape anything if text_len is 0, also some clients seem to have a NULL name, so use NONULL(p->priv). Signed-off-by: Pierre Habouzit --- client.c | 2 +- common/markup.c | 6 ++++-- widgets/taglist.c | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/client.c b/client.c index c0df7a7e7..ff859c3dc 100644 --- a/client.c +++ b/client.c @@ -768,7 +768,7 @@ client_markup_on_elem(markup_parser_data_t *p, const char *elem, const char **names, const char **values) { assert(!a_strcmp(elem, "title")); - buffer_add_xmlescaped(&p->text, p->priv); + buffer_add_xmlescaped(&p->text, NONULL(p->priv)); } /** Parse a markup string which contains special markup sequence relative to a diff --git a/common/markup.c b/common/markup.c index 9de51f68f..e34c585a7 100644 --- a/common/markup.c +++ b/common/markup.c @@ -113,8 +113,10 @@ markup_parse_text(GMarkupParseContext *context __attribute__ ((unused)), { markup_parser_data_t *p = (markup_parser_data_t *) user_data; - buffer_grow(&p->text, text_len); - buffer_add_xmlescaped(&p->text, text); + if (text_len) { + buffer_grow(&p->text, text_len); + buffer_add_xmlescaped(&p->text, text); + } } /** Create a markup_parser_data_t structure with elements list. diff --git a/widgets/taglist.c b/widgets/taglist.c index f7c5ef242..e883cd7cc 100644 --- a/widgets/taglist.c +++ b/widgets/taglist.c @@ -60,7 +60,7 @@ tag_markup_on_elem(markup_parser_data_t *p, const char *elem, const char **names, const char **values) { assert(!a_strcmp(elem, "title")); - buffer_add_xmlescaped(&p->text, p->priv); + buffer_add_xmlescaped(&p->text, NONULL(p->priv)); }