diff options
| author | 2017-02-07 03:03:15 +0100 | |
|---|---|---|
| committer | 2017-02-07 03:03:15 +0100 | |
| commit | e4dc36f18a3ba06183168111052b7b4e213c740b (patch) | |
| tree | fe50c564f3e87ddf101fb0e06daac8401d60b151 | |
| parent | ca33a2b7aebf7cadd480a80d1eb2284406061b08 (diff) | |
| download | libplist-e4dc36f18a3ba06183168111052b7b4e213c740b.tar.gz libplist-e4dc36f18a3ba06183168111052b7b4e213c740b.tar.bz2 | |
xplist: Prevent OOB read in two more cases
| -rw-r--r-- | src/xplist.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/xplist.c b/src/xplist.c index 7cee6de..d157200 100644 --- a/src/xplist.c +++ b/src/xplist.c | |||
| @@ -546,6 +546,11 @@ static text_part_t* get_text_parts(parse_ctx ctx, const char* tag, size_t tag_le | |||
| 546 | } | 546 | } |
| 547 | if (*ctx->pos == '!') { | 547 | if (*ctx->pos == '!') { |
| 548 | ctx->pos++; | 548 | ctx->pos++; |
| 549 | if (ctx->pos >= ctx->end-1) { | ||
| 550 | PLIST_XML_ERR("EOF while parsing <! special tag\n"); | ||
| 551 | ctx->err++; | ||
| 552 | return NULL; | ||
| 553 | } | ||
| 549 | if (*ctx->pos == '-' && *(ctx->pos+1) == '-') { | 554 | if (*ctx->pos == '-' && *(ctx->pos+1) == '-') { |
| 550 | if (last) { | 555 | if (last) { |
| 551 | last = text_part_append(last, p, q-p, 0); | 556 | last = text_part_append(last, p, q-p, 0); |
| @@ -844,6 +849,11 @@ static void node_from_xml(parse_ctx ctx, plist_t *plist, uint32_t depth) | |||
| 844 | ctx->pos+=8; | 849 | ctx->pos+=8; |
| 845 | while (ctx->pos < ctx->end) { | 850 | while (ctx->pos < ctx->end) { |
| 846 | find_next(ctx, " \t\r\n[>", 6, 1); | 851 | find_next(ctx, " \t\r\n[>", 6, 1); |
| 852 | if (ctx->pos >= ctx->end) { | ||
| 853 | PLIST_XML_ERR("EOF while parsing !DOCTYPE\n"); | ||
| 854 | ctx->err++; | ||
| 855 | goto err_out; | ||
| 856 | } | ||
| 847 | if (*ctx->pos == '[') { | 857 | if (*ctx->pos == '[') { |
| 848 | embedded_dtd = 1; | 858 | embedded_dtd = 1; |
| 849 | break; | 859 | break; |
