]> granicus.if.org Git - php/commitdiff
Merge branch 'PHP-5.6' into PHP-7.0
authorStanislav Malyshev <stas@php.net>
Thu, 4 Aug 2016 06:00:32 +0000 (23:00 -0700)
committerStanislav Malyshev <stas@php.net>
Thu, 4 Aug 2016 06:00:32 +0000 (23:00 -0700)
* PHP-5.6:
  Fix bug #72716 - initialize buffer before read

Conflicts:
ext/standard/ftp_fopen_wrapper.c

1  2 
ext/standard/ftp_fopen_wrapper.c

index 10dcdb8006a6e18f74067f1f98ee85fcb91f4e64,0d5384e3a5a015547025e8a79ea926786b39047b..82875777a05284896195f87b89e8a7123b011569
@@@ -80,8 -80,9 +80,9 @@@ typedef struct _php_ftp_dirstream_data 
  
  /* {{{ get_ftp_result
   */
 -static inline int get_ftp_result(php_stream *stream, char *buffer, size_t buffer_size TSRMLS_DC)
 +static inline int get_ftp_result(php_stream *stream, char *buffer, size_t buffer_size)
  {
+       buffer[0] = '\0'; /* in case read fails to read anything */
        while (php_stream_gets(stream, buffer, buffer_size-1) &&
                   !(isdigit((int) buffer[0]) && isdigit((int) buffer[1]) &&
                         isdigit((int) buffer[2]) && buffer[3] == ' '));
@@@ -729,13 -739,13 +730,13 @@@ php_stream * php_stream_ftp_opendir(php
  
        php_stream_context_set(datastream, context);
        if (use_ssl_on_data && (php_stream_xport_crypto_setup(datastream,
 -                      STREAM_CRYPTO_METHOD_SSLv23_CLIENT, NULL TSRMLS_CC) < 0 ||
 -                      php_stream_xport_crypto_enable(datastream, 1 TSRMLS_CC) < 0)) {
 +                      STREAM_CRYPTO_METHOD_SSLv23_CLIENT, NULL) < 0 ||
 +                      php_stream_xport_crypto_enable(datastream, 1) < 0)) {
  
 -              php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "Unable to activate SSL mode");
 +              php_stream_wrapper_log_error(wrapper, options, "Unable to activate SSL mode");
                php_stream_close(datastream);
                datastream = NULL;
-               goto opendir_errexit;   
+               goto opendir_errexit;
        }