]> granicus.if.org Git - php/commitdiff
Fixed segfault
authorXinchen Hui <laruence@gmail.com>
Wed, 5 Mar 2014 03:44:51 +0000 (11:44 +0800)
committerXinchen Hui <laruence@gmail.com>
Wed, 5 Mar 2014 03:44:51 +0000 (11:44 +0800)
ext/standard/streamsfuncs.c

index 69334933d4d0420740e53b6c5bc9e5bb3140629f..39c0d17bc20b88b3296fd7d70e4f997887cd97dd 100644 (file)
@@ -440,9 +440,11 @@ PHP_FUNCTION(stream_get_contents)
                }
        }
 
-       contents = php_stream_copy_to_mem(stream, maxlen, 0);
-
-       RETURN_STR(contents);
+       if ((contents = php_stream_copy_to_mem(stream, maxlen, 0))) {
+               RETURN_STR(contents);
+       } else {
+               RETURN_EMPTY_STRING();
+       }
 }
 /* }}} */