summaryrefslogtreecommitdiffstats
path: root/bug73150.patch
blob: 0482167b652eab3abdbb9d4de3d96779464508ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
Backported from 5.6.27 by Remi.


From 1c0e9126fbfb7fde3173347b7464237f56c38bfa Mon Sep 17 00:00:00 2001
From: Stanislav Malyshev <stas@php.net>
Date: Sun, 25 Sep 2016 21:25:01 -0700
Subject: [PATCH] Fix bug #73150: missing NULL check in dom_document_save_html

---
 ext/dom/document.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ext/dom/document.c b/ext/dom/document.c
index d33aaf1..1970c38 100644
--- a/ext/dom/document.c
+++ b/ext/dom/document.c
@@ -1853,7 +1853,7 @@ PHP_FUNCTION(dom_document_savexml)
 		if (options & LIBXML_SAVE_NOEMPTYTAG) {
 			xmlSaveNoEmptyTags = saveempty;
 		}
-		if (!size) {
+		if (!size || !mem) {
 			RETURN_FALSE;
 		}
 		RETVAL_STRINGL(mem, size, 1);
@@ -2388,7 +2388,7 @@ PHP_FUNCTION(dom_document_save_html)
 #else
 		htmlDocDumpMemory(docp, &mem, &size);
 #endif
-		if (!size) {
+		if (!size || !mem) {
 			RETVAL_FALSE;
 		} else {
 			RETVAL_STRINGL((const char*) mem, size, 1);
-- 
2.1.4