]> granicus.if.org Git - php/commitdiff
Nope, that last one wasn't a leak in main/streams.c, it was
authorWez Furlong <wez@php.net>
Tue, 15 Oct 2002 16:45:26 +0000 (16:45 +0000)
committerWez Furlong <wez@php.net>
Tue, 15 Oct 2002 16:45:26 +0000 (16:45 +0000)
file_get_contents misinterpreting the result...

ext/standard/file.c
main/streams.c

index b264a2a637b0e4585348dca589d4f71820302c7e..dfec2d67cf924a49bcac59e05bba9df72ef7bd7a 100644 (file)
@@ -435,7 +435,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 */
index a8ddccb1c5d88da60359114211cc7ef75120d105..8597d6bf33ff2986bd8f5b794ecd881d5e7553bd 100755 (executable)
@@ -1028,7 +1028,7 @@ PHPAPI size_t _php_stream_copy_to_mem(php_stream *src, char **buf, size_t maxlen
 #endif
                
                        srcfile = mmap(NULL, maxlen, PROT_READ, MAP_SHARED, srcfd, 0);
-                       if (srcfile != (void*)MAP_FAILED && ret > 0) {
+                       if (srcfile != (void*)MAP_FAILED) {
 
                                *buf = pemalloc_rel_orig(maxlen + 1, persistent);