]> sjero.net Git - wget/blobdiff - src/ftp.c
Duplicate string to circumvent eventual memory corruption.
[wget] / src / ftp.c
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)));
 
-  con->target = lf;
+  con->target = xstrdup (lf);
   err = ftp_loop_internal (u, NULL, con);
+  xfree (con->target);
   con->target = old_target;
 
   if (err == RETROK)