diff options
| author | 2017-02-07 03:12:40 +0100 | |
|---|---|---|
| committer | 2017-02-07 03:12:40 +0100 | |
| commit | fa4d1ce8a6d9c0f9b1d5bbcc82c675cac601daf5 (patch) | |
| tree | 22122871eab0160315ae1a06e5461638199dafcc /src | |
| parent | e4dc36f18a3ba06183168111052b7b4e213c740b (diff) | |
| download | libplist-fa4d1ce8a6d9c0f9b1d5bbcc82c675cac601daf5.tar.gz libplist-fa4d1ce8a6d9c0f9b1d5bbcc82c675cac601daf5.tar.bz2 | |
xplist: Also fix OOB read in find_char() and find_str() functions
Diffstat (limited to 'src')
| -rw-r--r-- | src/xplist.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/xplist.c b/src/xplist.c index d157200..d8d2d72 100644 --- a/src/xplist.c +++ b/src/xplist.c | |||
| @@ -435,6 +435,10 @@ static void find_char(parse_ctx ctx, char c, int skip_quotes) | |||
| 435 | if (skip_quotes && (c != '"') && (*(ctx->pos) == '"')) { | 435 | if (skip_quotes && (c != '"') && (*(ctx->pos) == '"')) { |
| 436 | ctx->pos++; | 436 | ctx->pos++; |
| 437 | find_char(ctx, '"', 0); | 437 | find_char(ctx, '"', 0); |
| 438 | if (ctx->pos >= ctx->end) { | ||
| 439 | PLIST_XML_ERR("EOF while looking for matching double quote\n"); | ||
| 440 | return; | ||
| 441 | } | ||
| 438 | if (*(ctx->pos) != '"') { | 442 | if (*(ctx->pos) != '"') { |
| 439 | PLIST_XML_ERR("Unmatched double quote\n"); | 443 | PLIST_XML_ERR("Unmatched double quote\n"); |
| 440 | return; | 444 | return; |
| @@ -453,6 +457,10 @@ static void find_str(parse_ctx ctx, const char *str, size_t len, int skip_quotes | |||
| 453 | if (skip_quotes && (*(ctx->pos) == '"')) { | 457 | if (skip_quotes && (*(ctx->pos) == '"')) { |
| 454 | ctx->pos++; | 458 | ctx->pos++; |
| 455 | find_char(ctx, '"', 0); | 459 | find_char(ctx, '"', 0); |
| 460 | if (ctx->pos >= ctx->end) { | ||
| 461 | PLIST_XML_ERR("EOF while looking for matching double quote\n"); | ||
| 462 | return; | ||
| 463 | } | ||
| 456 | if (*(ctx->pos) != '"') { | 464 | if (*(ctx->pos) != '"') { |
| 457 | PLIST_XML_ERR("Unmatched double quote\n"); | 465 | PLIST_XML_ERR("Unmatched double quote\n"); |
| 458 | return; | 466 | return; |
