summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSascha Schumann <sas@php.net>2003-05-14 08:27:48 +0000
committerSascha Schumann <sas@php.net>2003-05-14 08:27:48 +0000
commit31dc62a905e85d1a9360dfb71cb13cf22e79ce0c (patch)
tree5464bc12f301f5dcafbd2f309afb7c3e708e5303
parent82d513ee727787229e03a413ffabd1d29fc09968 (diff)
downloadphp-git-31dc62a905e85d1a9360dfb71cb13cf22e79ce0c.tar.gz
MFB segfault fix
-rw-r--r--ext/standard/file.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/ext/standard/file.c b/ext/standard/file.c
index 096444272a..784acfca8d 100644
--- a/ext/standard/file.c
+++ b/ext/standard/file.c
@@ -451,7 +451,7 @@ PHP_FUNCTION(file_get_contents)
}
/* 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)) {
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);
+ } else if (len == 0) {
+ RETVAL_EMPTY_STRING();
} else {
RETVAL_FALSE;
}