diff options
author | Antony Dovgal <tony2001@php.net> | 2007-09-21 12:57:38 +0000 |
---|---|---|
committer | Antony Dovgal <tony2001@php.net> | 2007-09-21 12:57:38 +0000 |
commit | 3587185a89b552142e22c773e4826d4fa3de2e7c (patch) | |
tree | 9a3efb9bcc2a03f81779817252da696f7c0ecd86 /ext/standard/ftp_fopen_wrapper.c | |
parent | 7985002fc694ee6dcca628cbf83a9cc6b546e7ab (diff) | |
download | php-git-3587185a89b552142e22c773e4826d4fa3de2e7c.tar.gz |
MFH: fix invalid read when opendir over FTP fails (coverity issue #462)
Diffstat (limited to 'ext/standard/ftp_fopen_wrapper.c')
-rw-r--r-- | ext/standard/ftp_fopen_wrapper.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/ext/standard/ftp_fopen_wrapper.c b/ext/standard/ftp_fopen_wrapper.c index 7ee5618575..f6ed4d68f2 100644 --- a/ext/standard/ftp_fopen_wrapper.c +++ b/ext/standard/ftp_fopen_wrapper.c @@ -669,6 +669,8 @@ php_stream * php_stream_ftp_opendir(php_stream_wrapper *wrapper, char *path, cha char ip[sizeof("123.123.123.123")]; unsigned short portno; + tmp_line[0] = '\0'; + stream = php_ftp_fopen_connect(wrapper, path, mode, options, opened_path, context, &reuseid, &resource, &use_ssl, &use_ssl_on_data TSRMLS_CC); if (!stream) { goto opendir_errexit; @@ -734,8 +736,9 @@ php_stream * php_stream_ftp_opendir(php_stream_wrapper *wrapper, char *path, cha php_stream_notify_error(context, PHP_STREAM_NOTIFY_FAILURE, tmp_line, result); php_stream_close(stream); } - if (tmp_line[0] != '\0') + if (tmp_line[0] != '\0') { php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "FTP server reports %s", tmp_line); + } return NULL; } /* }}} */ |