summaryrefslogtreecommitdiff
path: root/ext/libxml/libxml.c
diff options
context:
space:
mode:
authorXinchen Hui <laruence@gmail.com>2019-12-25 13:14:08 +0800
committerXinchen Hui <laruence@gmail.com>2019-12-25 13:14:08 +0800
commitd8ad2f4695ebd6dc2d4e668d9baeac1c071791a6 (patch)
treebfe6bbfb1c08ad458a295d0b2c72e47e302b3614 /ext/libxml/libxml.c
parentb5e004379647bd1ebb75eb2eac8826fb6abdd3d8 (diff)
downloadphp-git-d8ad2f4695ebd6dc2d4e668d9baeac1c071791a6.tar.gz
Fixed bug #79029 (Use After Free's in XMLReader / XMLWriter)
Diffstat (limited to 'ext/libxml/libxml.c')
-rw-r--r--ext/libxml/libxml.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/ext/libxml/libxml.c b/ext/libxml/libxml.c
index efccf0a407..837cc7ad98 100644
--- a/ext/libxml/libxml.c
+++ b/ext/libxml/libxml.c
@@ -355,6 +355,8 @@ static void *php_libxml_streams_IO_open_wrapper(const char *filename, const char
context = php_stream_context_from_zval(Z_ISUNDEF(LIBXML(stream_context))? NULL : &LIBXML(stream_context), 0);
ret_val = php_stream_open_wrapper_ex(path_to_open, (char *)mode, REPORT_ERRORS, NULL, context);
+ /* Prevent from closing this by fclose() */
+ ((php_stream*)ret_val)->flags |= PHP_STREAM_FLAG_NO_FCLOSE;
if (isescaped) {
xmlFree(resolved_path);
}