diff options
author | Sterling Hughes <sterling@php.net> | 2003-03-21 22:22:15 +0000 |
---|---|---|
committer | Sterling Hughes <sterling@php.net> | 2003-03-21 22:22:15 +0000 |
commit | 0a4282eabff64fd15a1fa3ad6f8dc04daedf4eca (patch) | |
tree | 41df3f2c1c53bf558bb4d19b5de289c89a307b04 | |
parent | f83c88e81dd670dd48a4ebbf9eeb8374f45b3fdf (diff) | |
download | php-git-0a4282eabff64fd15a1fa3ad6f8dc04daedf4eca.tar.gz |
fix segfault in file_set_contents() when the file could not successfully
be opened.
-rw-r--r-- | ext/standard/file.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/ext/standard/file.c b/ext/standard/file.c index 138b723fd4..b6d3779d06 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -476,6 +476,10 @@ PHP_FUNCTION(file_set_contents) stream = php_stream_open_wrapper(filename, "wb", (use_include_path ? USE_PATH : 0) | ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL); + if (stream == NULL) { + RETURN_FALSE; + } + if (data_len) { numbytes = php_stream_write(stream, data, data_len); if (numbytes < 0) { |