Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-6]: src/usr.bin/ftp Pull up following revision(s) (requested by c...
details: https://anonhg.NetBSD.org/src/rev/6705f7d13eaf
branches: netbsd-6
changeset: 776726:6705f7d13eaf
user: snj <snj%NetBSD.org@localhost>
date: Mon Oct 27 05:53:04 2014 +0000
description:
Pull up following revision(s) (requested by christos in ticket #1175):
usr.bin/ftp/fetch.c: revision 1.206 via patch
don't pay attention to special characters if they don't come from the command
line (from jmcneill)
diffstat:
usr.bin/ftp/fetch.c | 40 +++++++++++++++++++++++++---------------
1 files changed, 25 insertions(+), 15 deletions(-)
diffs (76 lines):
diff -r a50669fd8132 -r 6705f7d13eaf usr.bin/ftp/fetch.c
--- a/usr.bin/ftp/fetch.c Mon Oct 27 05:51:57 2014 +0000
+++ b/usr.bin/ftp/fetch.c Mon Oct 27 05:53:04 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fetch.c,v 1.195.2.1 2013/12/17 21:07:59 bouyer Exp $ */
+/* $NetBSD: fetch.c,v 1.195.2.2 2014/10/27 05:53:04 snj Exp $ */
/*-
* Copyright (c) 1997-2009 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: fetch.c,v 1.195.2.1 2013/12/17 21:07:59 bouyer Exp $");
+__RCSID("$NetBSD: fetch.c,v 1.195.2.2 2014/10/27 05:53:04 snj Exp $");
#endif /* not lint */
/*
@@ -571,7 +571,7 @@
url_decode(decodedpath);
if (outfile)
- savefile = ftp_strdup(outfile);
+ savefile = outfile;
else {
cp = strrchr(decodedpath, '/'); /* find savefile */
if (cp != NULL)
@@ -1150,18 +1150,27 @@
}
} /* end of ftp:// or http:// specific setup */
- /* Open the output file. */
- if (strcmp(savefile, "-") == 0) {
- fout = stdout;
- } else if (*savefile == '|') {
- oldpipe = xsignal(SIGPIPE, SIG_IGN);
- fout = popen(savefile + 1, "w");
- if (fout == NULL) {
- warn("Can't execute `%s'", savefile + 1);
- goto cleanup_fetch_url;
+ /* Open the output file. */
+
+ /*
+ * Only trust filenames with special meaning if they came from
+ * the command line
+ */
+
+ if (outfile == savefile) {
+ if (strcmp(savefile, "-") == 0) {
+ fout = stdout;
+ } else if (*savefile == '|') {
+ oldpipe = xsignal(SIGPIPE, SIG_IGN);
+ fout = popen(savefile + 1, "w");
+ if (fout == NULL) {
+ warn("Can't execute `%s'", savefile + 1);
+ goto cleanup_fetch_url;
+ }
+ closefunc = pclose;
}
- closefunc = pclose;
- } else {
+ }
+ if (fout == NULL) {
if ((rangeend != -1 && rangeend <= restart_point) ||
(rangestart == -1 && filesize != -1 && filesize <= restart_point)) {
/* already done */
@@ -1379,7 +1388,8 @@
(*closefunc)(fout);
if (res0)
freeaddrinfo(res0);
- FREEPTR(savefile);
+ if (savefile != outfile)
+ FREEPTR(savefile);
FREEPTR(uuser);
if (pass != NULL)
memset(pass, 0, strlen(pass));
Home |
Main Index |
Thread Index |
Old Index