]> sjero.net Git - wget/commitdiff
Duplicate string to circumvent eventual memory corruption.
authorSteven Schubiger <stsc@member.fsf.org>
Wed, 27 May 2009 19:47:57 +0000 (21:47 +0200)
committerSteven Schubiger <stsc@member.fsf.org>
Wed, 27 May 2009 19:47:57 +0000 (21:47 +0200)
src/ChangeLog
src/ftp.c

index 31170b7097918e87bf3378674d4f31fe2ebf1406..aca389f10e1e39161314e13536d036c0f95ae0d9 100644 (file)
@@ -1,3 +1,9 @@
+2009-05-27  Steven Schubiger  <stsc@member.fsf.org>
+
+       * 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  <stsc@member.fsf.org>
 
        * progress.c (eta_to_human_short): Fix the remaining hours
 2009-05-17  Steven Schubiger  <stsc@member.fsf.org>
 
        * progress.c (eta_to_human_short): Fix the remaining hours
index fe6ecd0a9e606d7c4331c7078767f7e483a66ae9..d58d67dfe87ff107ab59ed0b9c65c76f34356bb3 100644 (file)
--- 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)));
 
   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);
   err = ftp_loop_internal (u, NULL, con);
+  xfree (con->target);
   con->target = old_target;
 
   if (err == RETROK)
   con->target = old_target;
 
   if (err == RETROK)