]> granicus.if.org Git - php/commitdiff
Bug #22059. ftp_chdir() causes segfault. efree(ftp->pwd) was being called without...
authorSara Golemon <pollita@php.net>
Thu, 13 Feb 2003 19:48:49 +0000 (19:48 +0000)
committerSara Golemon <pollita@php.net>
Thu, 13 Feb 2003 19:48:49 +0000 (19:48 +0000)
actually pointed anywhere.

NEWS
ext/ftp/ftp.c

diff --git a/NEWS b/NEWS
index 93e6fda136949ecf14eaa6168b1bfcdc3d25c1c0..18da8f7e033f725fd8f53bfd75e888c49a8cd333 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,7 @@ PHP 4                                                                      NEWS
 ? ? ??? 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 8cafa790e01333d948bfb59d097fc6c00cfd49d6..b980d697089f220de4a59bc8fe09bd98cbf52fd5 100644 (file)
@@ -473,7 +473,8 @@ ftp_chdir(ftpbuf_t *ftp, const char *dir)
                return 0;
        }
 
-       efree(ftp->pwd);
+       if (ftp->pwd)
+               efree(ftp->pwd);
 
        if (!ftp_putcmd(ftp, "CWD", dir)) {
                return 0;
@@ -494,7 +495,8 @@ ftp_cdup(ftpbuf_t *ftp)
                return 0;
        }
 
-       efree(ftp->pwd);
+       if (ftp->pwd)
+               efree(ftp->pwd);
 
        if (!ftp_putcmd(ftp, "CDUP", NULL)) {
                return 0;