mirror of
https://github.com/php/php-src.git
synced 2025-08-18 15:08:55 +02:00
MFB segfault fix
This commit is contained in:
parent
82d513ee72
commit
31dc62a905
1 changed files with 3 additions and 1 deletions
|
@ -451,7 +451,7 @@ PHP_FUNCTION(file_get_contents)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* uses mmap if possible */
|
/* uses mmap if possible */
|
||||||
if ((len = php_stream_copy_to_mem(stream, &contents, PHP_STREAM_COPY_ALL, 0)) >= 0) {
|
if ((len = php_stream_copy_to_mem(stream, &contents, PHP_STREAM_COPY_ALL, 0)) > 0) {
|
||||||
|
|
||||||
if (PG(magic_quotes_runtime)) {
|
if (PG(magic_quotes_runtime)) {
|
||||||
contents = php_addslashes(contents, len, &newlen, 1 TSRMLS_CC); /* 1 = free source string */
|
contents = php_addslashes(contents, len, &newlen, 1 TSRMLS_CC); /* 1 = free source string */
|
||||||
|
@ -459,6 +459,8 @@ PHP_FUNCTION(file_get_contents)
|
||||||
}
|
}
|
||||||
|
|
||||||
RETVAL_STRINGL(contents, len, 0);
|
RETVAL_STRINGL(contents, len, 0);
|
||||||
|
} else if (len == 0) {
|
||||||
|
RETVAL_EMPTY_STRING();
|
||||||
} else {
|
} else {
|
||||||
RETVAL_FALSE;
|
RETVAL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue