Skip to content

Commit bbe2a13

Browse files
committed
Merge branch 'PHP-7.1'
* PHP-7.1: #74337 pointer returned by php_stream_fopen_tmpfile not validated in memory.c
2 parents 8db4bfe + 91cb9a6 commit bbe2a13

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

main/streams/memory.c

+6-1
Original file line numberDiff line numberDiff line change
@@ -489,9 +489,14 @@ static int php_stream_temp_cast(php_stream *stream, int castas, void **ret)
489489
return FAILURE;
490490
}
491491

492+
file = php_stream_fopen_tmpfile();
493+
if (file == NULL) {
494+
php_error_docref(NULL, E_WARNING, "Unable to create temporary file.");
495+
return FAILURE;
496+
}
497+
492498
/* perform the conversion and then pass the request on to the innerstream */
493499
membuf = php_stream_memory_get_buffer(ts->innerstream, &memsize);
494-
file = php_stream_fopen_tmpfile();
495500
php_stream_write(file, membuf, memsize);
496501
pos = php_stream_tell(ts->innerstream);
497502

0 commit comments

Comments
 (0)