pollita         Thu Feb 13 14:48:49 2003 EDT

  Modified files:              
    /php4       NEWS 
    /php4/ext/ftp       ftp.c 
  Log:
  Bug #22059. ftp_chdir() causes segfault.  efree(ftp->pwd) was being called without 
knowing for certain that ftp->pwd
  actually pointed anywhere.
  
  
Index: php4/NEWS
diff -u php4/NEWS:1.1337 php4/NEWS:1.1338
--- php4/NEWS:1.1337    Thu Feb 13 12:01:28 2003
+++ php4/NEWS   Thu Feb 13 14:48:48 2003
@@ -3,6 +3,7 @@
 ? ? ??? 200?, Version 5.0.0
 - Moved extensions to PECL (http://pear.php.net/): (James, Tal)
   . ext/fribidi
+- Fixed bug #22059 (ftp_chdir causes segfault). (Sara)
 - Fixed bug #20442 (upgraded bundled expat to 1.95.5). (Ilia)
 - Fixed bug #20155 (xmlrpc compile problem with ZE2). (Derick, Jan Schneider)
 - Changed get_extension_funcs() to return list of the built-in Zend Engine 
Index: php4/ext/ftp/ftp.c
diff -u php4/ext/ftp/ftp.c:1.76 php4/ext/ftp/ftp.c:1.77
--- php4/ext/ftp/ftp.c:1.76     Thu Jan 30 23:54:57 2003
+++ php4/ext/ftp/ftp.c  Thu Feb 13 14:48:49 2003
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: ftp.c,v 1.76 2003/01/31 04:54:57 pollita Exp $ */
+/* $Id: ftp.c,v 1.77 2003/02/13 19:48:49 pollita Exp $ */
 
 #include "php.h"
 
@@ -473,7 +473,8 @@
                return 0;
        }
 
-       efree(ftp->pwd);
+       if (ftp->pwd)
+               efree(ftp->pwd);
 
        if (!ftp_putcmd(ftp, "CWD", dir)) {
                return 0;
@@ -494,7 +495,8 @@
                return 0;
        }
 
-       efree(ftp->pwd);
+       if (ftp->pwd)
+               efree(ftp->pwd);
 
        if (!ftp_putcmd(ftp, "CDUP", NULL)) {
                return 0;



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

Reply via email to