summaryrefslogtreecommitdiffstats
path: root/src/xplist.c
diff options
context:
space:
mode:
authorGravatar Filippo Bigarella2016-10-31 02:44:02 +0100
committerGravatar Nikias Bassen2016-10-31 02:44:02 +0100
commit6b9ab336fe3408a4f073a487f5265a1a2ed101f7 (patch)
treeeedab65cbdac502796ea2261a171a656967fdbde /src/xplist.c
parent62bac060ed5ee6d64a71edf6cc627cc184ae87e5 (diff)
downloadlibplist-6b9ab336fe3408a4f073a487f5265a1a2ed101f7.tar.gz
libplist-6b9ab336fe3408a4f073a487f5265a1a2ed101f7.tar.bz2
xplist: Prevent NULL pointer dereference when parsing <real> nodes
Diffstat (limited to 'src/xplist.c')
-rw-r--r--src/xplist.c8
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)
} else if (!strcmp(tag, XPLIST_REAL)) {
if (!is_empty) {
char *strval = get_text_content(ctx, tag, 1, 0);
+ if (!strval) {
+ PLIST_XML_ERR("Couldn't get text content for '%s' node\n", tag);
+ ctx->pos = ctx->end;
+ ctx->err++;
+ free(tag);
+ free(keyname);
+ return;
+ }
data->realval = atof((char *) strval);
free(strval);
}