From 4a27c8a032975ff0db44364d93db5ca6108d02ab Mon Sep 17 00:00:00 2001 From: Sara Golemon Date: Thu, 13 Feb 2003 19:51:02 +0000 Subject: [PATCH] MFH(Bug 22059, ftp.c-r1.77) --- NEWS | 1 + ext/ftp/ftp.c | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index cec0d3e116..99d0ce0142 100644 --- a/NEWS +++ b/NEWS @@ -30,6 +30,7 @@ PHP 4 NEWS - Fixed bug #22103 (Added gdImageEllipse and replaced old gdImageFilledEllipse with a better implementation). (Pierre) - Fixed bug #22088 (array_shift() left next index to be +1 too much). (Jani) +- Fixed buf #22059 (ftp_chdir() causes segfault). (Sara) - Fixed bug #22048 (crash in imap_header() when the e-mail contains an abnormally large number of special characters). (Ilia) - Fixed bug #22042 (pg_result_seek() would never seek to the 1st row in the diff --git a/ext/ftp/ftp.c b/ext/ftp/ftp.c index 67a0ca291b..b1c905e5a1 100644 --- a/ext/ftp/ftp.c +++ b/ext/ftp/ftp.c @@ -421,8 +421,8 @@ ftp_chdir(ftpbuf_t *ftp, const char *dir) { if (ftp == NULL) return 0; - - efree(ftp->pwd); + if (ftp->pwd) + efree(ftp->pwd); ftp->pwd = NULL; if (!ftp_putcmd(ftp, "CWD", dir)) @@ -442,7 +442,8 @@ ftp_cdup(ftpbuf_t *ftp) if (ftp == NULL) return 0; - efree(ftp->pwd); + if (ftp->pwd) + efree(ftp->pwd); ftp->pwd = NULL; if (!ftp_putcmd(ftp, "CDUP", NULL)) -- 2.40.0