Sophie

Sophie

distrib > Mageia > 5 > x86_64 > media > core-updates-src > by-pkgid > fde688f3069f2918988ce2c95b33f20b > files > 28

libplist-1.12-1.mga5.src.rpm

From 56ba9bf7f625f6b72df982e7ef298b9791b1cf47 Mon Sep 17 00:00:00 2001
From: Nikias Bassen <nikias@gmx.li>
Date: Tue, 7 Feb 2017 12:44:52 +0100
Subject: [PATCH 37/41] bplist: Make sure to bail out if malloc() fails in
 parse_data_node()

Credit to OSS-Fuzz
---
 src/bplist.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/bplist.c b/src/bplist.c
index 20e5090..c1f6007 100644
--- a/src/bplist.c
+++ b/src/bplist.c
@@ -394,6 +394,10 @@ static plist_t parse_data_node(const char **bnode, uint64_t size)
     data->type = PLIST_DATA;
     data->length = size;
     data->buff = (uint8_t *) malloc(sizeof(uint8_t) * size);
+    if (!data->strval) {
+        plist_free_data(data);
+        return NULL;
+    }
     memcpy(data->buff, *bnode, sizeof(uint8_t) * size);
 
     return node_create(NULL, data);
-- 
2.6.6