summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2017-01-02 00:17:23 +0100
committerGravatar Nikias Bassen2017-01-02 00:17:23 +0100
commit7946f2f0550251b1e876662c6f31bf6190c9f3bc (patch)
tree117f07ccc30b5e8753027527d43f76a39a7ed1a0
parentc2ea55aa6cac25934c08a5408e6ad23ab69e824a (diff)
downloadlibplist-7946f2f0550251b1e876662c6f31bf6190c9f3bc.tar.gz
libplist-7946f2f0550251b1e876662c6f31bf6190c9f3bc.tar.bz2
xplist: Allow whitespace after name in closing tag
'</key >' is a perfectly valid closing tag and so is '</key >' (note the newline). This commit will make the parser skip any encountered whitespace before checking for the closing '>'.
-rw-r--r--src/xplist.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/xplist.c b/src/xplist.c
index 11b7400..d15f52d 100644
--- a/src/xplist.c
+++ b/src/xplist.c
@@ -607,8 +607,13 @@ static text_part_t* get_text_parts(parse_ctx ctx, const char* tag, size_t tag_le
return NULL;
}
ctx->pos+=tag_len;
- if (ctx->pos >= ctx->end || *ctx->pos != '>') {
- PLIST_XML_ERR("EOF or no '>' after tag name\n");
+ parse_skip_ws(ctx);
+ if (ctx->pos >= ctx->end) {
+ PLIST_XML_ERR("EOF while parsing closing tag\n");
+ ctx->err++;
+ return NULL;
+ } else if (*ctx->pos != '>') {
+ PLIST_XML_ERR("Invalid closing tag; expected '>', found '%c'\n", *ctx->pos);
ctx->err++;
return NULL;
}