summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/xplist.c30
1 files changed, 23 insertions, 7 deletions
diff --git a/src/xplist.c b/src/xplist.c
index e5ba214..4438236 100644
--- a/src/xplist.c
+++ b/src/xplist.c
@@ -468,19 +468,35 @@ static void find_next(parse_ctx ctx, const char *nextchars, int skip_quotes)
468 468
469static char* get_text_content(parse_ctx ctx, const char* tag, int skip_ws, int unescape_entities) 469static char* get_text_content(parse_ctx ctx, const char* tag, int skip_ws, int unescape_entities)
470{ 470{
471 const char *p; 471 const char *p = NULL;
472 const char *q; 472 const char *q = NULL;
473 int taglen; 473 int taglen = 0;
474 char *str; 474 char *str = NULL;
475 int i = 0; 475 int i = 0;
476 476
477 if (skip_ws) { 477 if (skip_ws) {
478 parse_skip_ws(ctx); 478 parse_skip_ws(ctx);
479 } 479 }
480 p = ctx->pos; 480 p = ctx->pos;
481 find_char(ctx, '<', 1); 481 if (strncmp(ctx->pos, "<![CDATA[", 9) == 0) {
482 if (*ctx->pos != '<') { PLIST_XML_ERR("didn't find <\n"); return NULL; } 482 ctx->pos+=9;
483 q = ctx->pos; 483 p = ctx->pos;
484 find_str(ctx, "]]>", 0);
485 if (ctx->pos >= ctx->end || strncmp(ctx->pos, "]]>", 3) != 0) {
486 PLIST_XML_ERR("EOF while looking for end of CDATA block\n");
487 return NULL;
488 }
489 q = ctx->pos;
490 ctx->pos+=3;
491 }
492 find_char(ctx, '<', 0);
493 if (*ctx->pos != '<') {
494 PLIST_XML_ERR("EOF while looking for closing tag\n");
495 return NULL;
496 }
497 if (!q) {
498 q = ctx->pos;
499 }
484 ctx->pos++; 500 ctx->pos++;
485 if (ctx->pos >= ctx->end || *ctx->pos != '/') { PLIST_XML_ERR("EOF or empty tag while parsing '%s'\n",p); return NULL; } 501 if (ctx->pos >= ctx->end || *ctx->pos != '/') { PLIST_XML_ERR("EOF or empty tag while parsing '%s'\n",p); return NULL; }
486 ctx->pos++; 502 ctx->pos++;