com php-src: Fix bug #73150: missing NULL check in dom_docume nt_save_html: ext/dom/document.c
| From: | Anatol Belski | Date: | Thu, 13 Oct 2016 23:40:12 +0000 |
| Subject: | com php-src: Fix bug #73150: missing NULL check in dom_docume nt_save_html: ext/dom/document.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-95065@lists.php.net to get a copy of this message | ||
Commit: 336322ce63f4d6bd2abd2b187c9de387f387593f
Author: Stanislav Malyshev <stas@php.net> Sun, 25 Sep 2016 21:25:01 -0700
Committer: Anatol Belski <ab@php.net> Fri, 14 Oct 2016 01:40:12 +0200
Parents: 6b2992f54cb46a4ed559097a67b5c6fa8f5011b9
Branches: PHP-7.1
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=336322ce63f4d6bd2abd2b187c9de387f387593f
Log:
Fix bug #73150: missing NULL check in dom_document_save_html
(cherry picked from commit 1c0e9126fbfb7fde3173347b7464237f56c38bfa)
(cherry picked from commit d1e878f2726e65502fdd992c5b57feeada57893f)
Bugs:
https://bugs.php.net/73150
Changed paths:
M ext/dom/document.c
Diff:
diff --git a/ext/dom/document.c b/ext/dom/document.c
index 70289cf..a5e119f 100644
--- a/ext/dom/document.c
+++ b/ext/dom/document.c
@@ -1663,7 +1663,7 @@ PHP_FUNCTION(dom_document_savexml)
if (options & LIBXML_SAVE_NOEMPTYTAG) {
xmlSaveNoEmptyTags = saveempty;
}
- if (!size) {
+ if (!size || !mem) {
RETURN_FALSE;
}
RETVAL_STRINGL((char *) mem, size);
@@ -2215,7 +2215,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);