File 0029-bplist-Make-sure-to-bail-out-if-malloc-fails-in-pars.patch of Package libplist.4090

From fbd8494d5e4e46bf2e90cb6116903e404374fb56 Mon Sep 17 00:00:00 2001
From: Nikias Bassen <nikias@gmx.li>
Date: Tue, 7 Feb 2017 12:43:27 +0100
Subject: [PATCH 36/41] bplist: Make sure to bail out if malloc() fails in
 parse_string_node()

Credit to Wang Junjie <zhunkibatu@gmail.com> (#93)
---
 src/bplist.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/bplist.c b/src/bplist.c
index 81bd716..20e5090 100644
--- a/src/bplist.c
+++ b/src/bplist.c
@@ -289,6 +289,10 @@ static plist_t parse_string_node(const char **bnode, uint64_t size)
 
     data->type = PLIST_STRING;
     data->strval = (char *) malloc(sizeof(char) * (size + 1));
+    if (!data->strval) {
+        plist_free_data(data);
+        return NULL;
+    }
     memcpy(data->strval, *bnode, size);
     data->strval[size] = '\0';
     data->length = strlen(data->strval);
-- 
2.6.6

openSUSE Build Service is sponsored by