Skip to content

Instantly share code, notes, and snippets.

/73150.diff Secret

Created September 26, 2016 04:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/2aeeeff7776f2edb701c7a350e66d181 to your computer and use it in GitHub Desktop.
Save anonymous/2aeeeff7776f2edb701c7a350e66d181 to your computer and use it in GitHub Desktop.
Patch for 73150
commit 1c0e9126fbfb7fde3173347b7464237f56c38bfa
Author: Stanislav Malyshev <stas@php.net>
Date: Sun Sep 25 21:25:01 2016 -0700
Fix bug #73150: missing NULL check in dom_document_save_html
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
@@ -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);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment