summaryrefslogtreecommitdiffstats
path: root/src
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 /src
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.
Diffstat (limited to 'src')
-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)
621 if (*ctx->pos != '<') { 621 if (*ctx->pos != '<') {
622 PLIST_XML_ERR("Failed to parse XML. Expected: opening tag, found: '%s', pos: %s\n", start, ctx->pos); 622 PLIST_XML_ERR("Failed to parse XML. Expected: opening tag, found: '%s', pos: %s\n", start, ctx->pos);
623 ctx->pos = ctx->end; 623 ctx->pos = ctx->end;
624 ctx->err++;
624 break; 625 break;
625 } 626 }
626 ctx->pos++; 627 ctx->pos++;
@@ -828,7 +829,6 @@ static void node_from_xml(parse_ctx ctx, plist_t *plist)
828 free(tag); 829 free(tag);
829 plist_free(subnode); 830 plist_free(subnode);
830 subnode = NULL; 831 subnode = NULL;
831 ctx->pos++;
832 continue; 832 continue;
833 } else { 833 } else {
834 data->strval = str; 834 data->strval = str;
@@ -953,7 +953,6 @@ static void node_from_xml(parse_ctx ctx, plist_t *plist)
953 break; 953 break;
954 } 954 }
955 } 955 }
956 ctx->pos++;
957 } 956 }
958 if (ctx->err) { 957 if (ctx->err) {
959 plist_free(*plist); 958 plist_free(*plist);