diff options
| author | 2016-10-31 02:44:02 +0100 | |
|---|---|---|
| committer | 2016-10-31 02:44:02 +0100 | |
| commit | 6b9ab336fe3408a4f073a487f5265a1a2ed101f7 (patch) | |
| tree | eedab65cbdac502796ea2261a171a656967fdbde | |
| parent | 62bac060ed5ee6d64a71edf6cc627cc184ae87e5 (diff) | |
| download | libplist-6b9ab336fe3408a4f073a487f5265a1a2ed101f7.tar.gz libplist-6b9ab336fe3408a4f073a487f5265a1a2ed101f7.tar.bz2 | |
xplist: Prevent NULL pointer dereference when parsing <real> nodes
| -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 87b21bb..36db07d 100644 --- a/src/xplist.c +++ b/src/xplist.c | |||
| @@ -728,6 +728,14 @@ static void node_from_xml(parse_ctx ctx, plist_t *plist) | |||
| 728 | } else if (!strcmp(tag, XPLIST_REAL)) { | 728 | } else if (!strcmp(tag, XPLIST_REAL)) { |
| 729 | if (!is_empty) { | 729 | if (!is_empty) { |
| 730 | char *strval = get_text_content(ctx, tag, 1, 0); | 730 | char *strval = get_text_content(ctx, tag, 1, 0); |
| 731 | if (!strval) { | ||
| 732 | PLIST_XML_ERR("Couldn't get text content for '%s' node\n", tag); | ||
| 733 | ctx->pos = ctx->end; | ||
| 734 | ctx->err++; | ||
| 735 | free(tag); | ||
| 736 | free(keyname); | ||
| 737 | return; | ||
| 738 | } | ||
| 731 | data->realval = atof((char *) strval); | 739 | data->realval = atof((char *) strval); |
| 732 | free(strval); | 740 | free(strval); |
| 733 | } | 741 | } |
