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 <madcoder@debian.org>
This commit is contained in:
Pierre Habouzit 2008-06-23 18:43:32 +02:00 committed by Julien Danjou
parent 0b93318836
commit 17744fc81d
3 changed files with 6 additions and 4 deletions

View File

@ -768,7 +768,7 @@ client_markup_on_elem(markup_parser_data_t *p, const char *elem,
const char **names, const char **values) const char **names, const char **values)
{ {
assert(!a_strcmp(elem, "title")); 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 /** Parse a markup string which contains special markup sequence relative to a

View File

@ -113,9 +113,11 @@ markup_parse_text(GMarkupParseContext *context __attribute__ ((unused)),
{ {
markup_parser_data_t *p = (markup_parser_data_t *) user_data; markup_parser_data_t *p = (markup_parser_data_t *) user_data;
if (text_len) {
buffer_grow(&p->text, text_len); buffer_grow(&p->text, text_len);
buffer_add_xmlescaped(&p->text, text); buffer_add_xmlescaped(&p->text, text);
} }
}
/** Create a markup_parser_data_t structure with elements list. /** Create a markup_parser_data_t structure with elements list.
* \param a pointer to an allocated markup_parser_data_t which must be wiped * \param a pointer to an allocated markup_parser_data_t which must be wiped

View File

@ -60,7 +60,7 @@ tag_markup_on_elem(markup_parser_data_t *p, const char *elem,
const char **names, const char **values) const char **names, const char **values)
{ {
assert(!a_strcmp(elem, "title")); assert(!a_strcmp(elem, "title"));
buffer_add_xmlescaped(&p->text, p->priv); buffer_add_xmlescaped(&p->text, NONULL(p->priv));
} }