]> granicus.if.org Git - php/commitdiff
Fix bug #73150: missing NULL check in dom_document_save_html
authorStanislav Malyshev <stas@php.net>
Mon, 26 Sep 2016 04:25:01 +0000 (21:25 -0700)
committerStanislav Malyshev <stas@php.net>
Mon, 26 Sep 2016 04:25:01 +0000 (21:25 -0700)
ext/dom/document.c

index d33aaf160e87e7989d8b5c587b1a7cb15b51b1c6..1970c38574fa8d1bf419dc2181915f0cbed0cb2c 100644 (file)
@@ -1792,7 +1792,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);
@@ -2327,7 +2327,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);