summaryrefslogtreecommitdiff
path: root/ext/ftp
diff options
context:
space:
mode:
authorSara Golemon <pollita@php.net>2003-09-09 21:15:20 +0000
committerSara Golemon <pollita@php.net>2003-09-09 21:15:20 +0000
commit3f585ac9238ebdce0198e447f6ce8399d247df02 (patch)
treeae2695578ccefb46152c11b2d2f4a15c9bce0b16 /ext/ftp
parentf7972bc8be9bfa21831955c3c77b93fc4f956e79 (diff)
downloadphp-git-3f585ac9238ebdce0198e447f6ce8399d247df02.tar.gz
MFH(r-1.91) Fix Bug #25294 LIST/NLST can cause segfault because ftp->data not cleaned properly
Diffstat (limited to 'ext/ftp')
-rw-r--r--ext/ftp/ftp.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/ext/ftp/ftp.c b/ext/ftp/ftp.c
index 1d20ec2fc3..01710ec656 100644
--- a/ext/ftp/ftp.c
+++ b/ext/ftp/ftp.c
@@ -421,9 +421,10 @@ ftp_chdir(ftpbuf_t *ftp, const char *dir)
{
if (ftp == NULL)
return 0;
- if (ftp->pwd)
+ if (ftp->pwd) {
efree(ftp->pwd);
- ftp->pwd = NULL;
+ ftp->pwd = NULL;
+ }
if (!ftp_putcmd(ftp, "CWD", dir))
return 0;
@@ -442,9 +443,10 @@ ftp_cdup(ftpbuf_t *ftp)
if (ftp == NULL)
return 0;
- if (ftp->pwd)
+ if (ftp->pwd) {
efree(ftp->pwd);
- ftp->pwd = NULL;
+ ftp->pwd = NULL;
+ }
if (!ftp_putcmd(ftp, "CDUP", NULL))
return 0;
@@ -1535,8 +1537,7 @@ ftp_genlist(ftpbuf_t *ftp, const char *cmd, const char *path TSRMLS_DC)
return ret;
bail:
- if (data)
- ftp->data = data_close(ftp, data);
+ ftp->data = data_close(ftp, data);
fclose(tmpfp);
if (ret)
efree(ret);