From: Antony Dovgal Date: Fri, 21 Sep 2007 12:57:38 +0000 (+0000) Subject: MFH: fix invalid read when opendir over FTP fails (coverity issue #462) X-Git-Tag: php-5.2.5RC1~113 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3587185a89b552142e22c773e4826d4fa3de2e7c;p=php MFH: fix invalid read when opendir over FTP fails (coverity issue #462) --- 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; } /* }}} */