From 1df3a351069dae4614ef23af6a08aab6d94a5cfb Mon Sep 17 00:00:00 2001 From: Steven Schubiger Date: Wed, 27 May 2009 21:47:57 +0200 Subject: [PATCH] Duplicate string to circumvent eventual memory corruption. --- src/ChangeLog | 6 ++++++ src/ftp.c | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/ChangeLog b/src/ChangeLog index 31170b70..aca389f1 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2009-05-27 Steven Schubiger + + * ftp.c (ftp_get_listing): Duplicate the "listing file" + string to avoid memory corruption when FOPEN_EXCL_ERR is + encountered. + 2009-05-17 Steven Schubiger * progress.c (eta_to_human_short): Fix the remaining hours diff --git a/src/ftp.c b/src/ftp.c index fe6ecd0a..d58d67df 100644 --- a/src/ftp.c +++ b/src/ftp.c @@ -1370,8 +1370,9 @@ ftp_get_listing (struct url *u, ccon *con, struct fileinfo **f) xfree (uf); DEBUGP ((_("Using %s as listing tmp file.\n"), quote (lf))); - con->target = lf; + con->target = xstrdup (lf); err = ftp_loop_internal (u, NULL, con); + xfree (con->target); con->target = old_target; if (err == RETROK) -- 2.39.2