iliaa           Sun Aug 15 21:41:15 2004 EDT

  Modified files:              
    /php-src/ext/standard       ftp_fopen_wrapper.c 
  Log:
  Fixed bug #29678 (opendir() with ftp:// wrapper segfaults if path does not 
  have trailing slash).
  
  
http://cvs.php.net/diff.php/php-src/ext/standard/ftp_fopen_wrapper.c?r1=1.77&r2=1.78&ty=u
Index: php-src/ext/standard/ftp_fopen_wrapper.c
diff -u php-src/ext/standard/ftp_fopen_wrapper.c:1.77 
php-src/ext/standard/ftp_fopen_wrapper.c:1.78
--- php-src/ext/standard/ftp_fopen_wrapper.c:1.77       Sat Jul 24 00:14:26 2004
+++ php-src/ext/standard/ftp_fopen_wrapper.c    Sun Aug 15 21:41:14 2004
@@ -18,7 +18,7 @@
    |          Sara Golemon <[EMAIL PROTECTED]>                              |
    +----------------------------------------------------------------------+
  */
-/* $Id: ftp_fopen_wrapper.c,v 1.77 2004/07/24 04:14:26 pollita Exp $ */
+/* $Id: ftp_fopen_wrapper.c,v 1.78 2004/08/16 01:41:14 iliaa Exp $ */
 
 #include "php.h"
 #include "php_globals.h"
@@ -126,8 +126,12 @@
        char tmp_line[512];
 
        resource = php_url_parse(path);
-       if (resource == NULL || resource->path == NULL)
+       if (resource == NULL || resource->path == NULL) {
+               if (resource && presource) {
+                       *presource = resource;
+               }
                return NULL;
+       }
 
        use_ssl = resource->scheme && (strlen(resource->scheme) > 3) && 
resource->scheme[3] == 's';
 
@@ -659,6 +663,9 @@
        unsigned short portno;
 
        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;   
+       }
 
        /* set the connection to be ascii */
        php_stream_write_string(stream, "TYPE A\r\n");

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to