summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSara Golemon <pollita@php.net>2003-02-13 19:48:49 +0000
committerSara Golemon <pollita@php.net>2003-02-13 19:48:49 +0000
commitd1d0d0b71aadbe381070ea9b383002c2a51547bb (patch)
tree2023edc450bb0af3a6f0196f776ea2fd394e4c80
parentaa8dfa0b74b7b5bd8a221f66a41ebbe1a35bd49e (diff)
downloadphp-git-d1d0d0b71aadbe381070ea9b383002c2a51547bb.tar.gz
Bug #22059. ftp_chdir() causes segfault. efree(ftp->pwd) was being called without knowing for certain that ftp->pwd
actually pointed anywhere.
-rw-r--r--NEWS1
-rw-r--r--ext/ftp/ftp.c6
2 files changed, 5 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index 93e6fda136..18da8f7e03 100644
--- 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
diff --git a/ext/ftp/ftp.c b/ext/ftp/ftp.c
index 8cafa790e0..b980d69708 100644
--- a/ext/ftp/ftp.c
+++ b/ext/ftp/ftp.c
@@ -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;