summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2016-11-28 12:09:42 +0100
committerGravatar Nikias Bassen2016-11-28 12:09:42 +0100
commit5e8fb617b8f7857693e7b41f56eaa6767ed6a54d (patch)
tree80a94dfe4040fec5407e978c0e01be03e534c5c6
parent950b6ddc3e503c4e1e3cb5d7813cdd9b41849cbc (diff)
downloadlibplist-5e8fb617b8f7857693e7b41f56eaa6767ed6a54d.tar.gz
libplist-5e8fb617b8f7857693e7b41f56eaa6767ed6a54d.tar.bz2
xplist: Fix parsing of adjacent nodes without whitespace between them
The context position counter was increased after encountering a closing node, e.g. '</dict>' or after a closing '</key>' node. When a node followed it directly without any whitespace inbetween, e.g. </dict><key>, parsing would fail since the parser would look at 'key>' instead of '<key>' for the next node to be parsed.
-rw-r--r--src/xplist.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/xplist.c b/src/xplist.c
index 0cb891c..dc824e2 100644
--- a/src/xplist.c
+++ b/src/xplist.c
@@ -621,6 +621,7 @@ static void node_from_xml(parse_ctx ctx, plist_t *plist)
if (*ctx->pos != '<') {
PLIST_XML_ERR("Failed to parse XML. Expected: opening tag, found: '%s', pos: %s\n", start, ctx->pos);
ctx->pos = ctx->end;
+ ctx->err++;
break;
}
ctx->pos++;
@@ -828,7 +829,6 @@ static void node_from_xml(parse_ctx ctx, plist_t *plist)
free(tag);
plist_free(subnode);
subnode = NULL;
- ctx->pos++;
continue;
} else {
data->strval = str;
@@ -953,7 +953,6 @@ static void node_from_xml(parse_ctx ctx, plist_t *plist)
break;
}
}
- ctx->pos++;
}
if (ctx->err) {
plist_free(*plist);