Merge branch 'PHP-7.1'

* PHP-7.1:
  #74337 pointer returned by php_stream_fopen_tmpfile not validated in memory.c
This commit is contained in:
Anatol Belski 2017-04-22 21:59:07 +02:00
commit bbe2a13395

View file

@ -489,9 +489,14 @@ static int php_stream_temp_cast(php_stream *stream, int castas, void **ret)
return FAILURE;
}
file = php_stream_fopen_tmpfile();
if (file == NULL) {
php_error_docref(NULL, E_WARNING, "Unable to create temporary file.");
return FAILURE;
}
/* perform the conversion and then pass the request on to the innerstream */
membuf = php_stream_memory_get_buffer(ts->innerstream, &memsize);
file = php_stream_fopen_tmpfile();
php_stream_write(file, membuf, memsize);
pos = php_stream_tell(ts->innerstream);