summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2006-07-10 22:19:53 +1000
committerDamien Miller <djm@mindrot.org>2006-07-10 22:19:53 +1000
commit3d1a9f4d5dfed0d2607b7cb36e1608255a669a17 (patch)
treeaae62c88613c8f1ffade3be2d5b8722cce03fb30
parenta1738e4c65108b9c549c66c3a668a04b86c1530c (diff)
- djm@cvs.openbsd.org 2006/07/10 12:03:20
[scp.c] duplicate argv at the start of main() because it gets modified later; pointed out by deraadt@ ok markus@
-rw-r--r--ChangeLog7
-rw-r--r--scp.c12
2 files changed, 15 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 30356693d..e411230f2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -87,6 +87,11 @@
87 [openbsd-compat/mktemp.c openbsd-compat/openbsd-compat.h] 87 [openbsd-compat/mktemp.c openbsd-compat/openbsd-compat.h]
88 [openbsd-compat/port-tun.c openbsd-compat/readpassphrase.c] 88 [openbsd-compat/port-tun.c openbsd-compat/readpassphrase.c]
89 [openbsd-compat/xcrypt.c] Fix includes.h fallout, mainly fcntl.h 89 [openbsd-compat/xcrypt.c] Fix includes.h fallout, mainly fcntl.h
90 - OpenBSD CVS Sync
91 - djm@cvs.openbsd.org 2006/07/10 12:03:20
92 [scp.c]
93 duplicate argv at the start of main() because it gets modified later;
94 pointed out by deraadt@ ok markus@
90 95
9120060706 9620060706
92 - (dtucker) [configure.ac] Try AIX blibpath test in different order when 97 - (dtucker) [configure.ac] Try AIX blibpath test in different order when
@@ -4820,4 +4825,4 @@
4820 - (djm) Trim deprecated options from INSTALL. Mention UsePAM 4825 - (djm) Trim deprecated options from INSTALL. Mention UsePAM
4821 - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu 4826 - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu
4822 4827
4823$Id: ChangeLog,v 1.4381 2006/07/10 11:33:04 djm Exp $ 4828$Id: ChangeLog,v 1.4382 2006/07/10 12:19:53 djm Exp $
diff --git a/scp.c b/scp.c
index 600df161a..6fe246d8c 100644
--- a/scp.c
+++ b/scp.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: scp.c,v 1.144 2006/07/09 15:15:10 stevesk Exp $ */ 1/* $OpenBSD: scp.c,v 1.145 2006/07/10 12:03:20 djm Exp $ */
2/* 2/*
3 * scp - secure remote copy. This is basically patched BSD rcp which 3 * scp - secure remote copy. This is basically patched BSD rcp which
4 * uses ssh to do the data transfer (instead of using rcmd). 4 * uses ssh to do the data transfer (instead of using rcmd).
@@ -272,15 +272,21 @@ void usage(void);
272int 272int
273main(int argc, char **argv) 273main(int argc, char **argv)
274{ 274{
275 int ch, fflag, tflag, status; 275 int ch, fflag, tflag, status, n;
276 double speed; 276 double speed;
277 char *targ, *endp; 277 char *targ, *endp, **newargv;
278 extern char *optarg; 278 extern char *optarg;
279 extern int optind; 279 extern int optind;
280 280
281 /* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */ 281 /* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */
282 sanitise_stdfd(); 282 sanitise_stdfd();
283 283
284 /* Copy argv, because we modify it */
285 newargv = xcalloc(MAX(argc + 1, 1), sizeof(*newargv));
286 for (n = 0; n < argc; n++)
287 newargv[n] = xstrdup(argv[n]);
288 argv = newargv;
289
284 __progname = ssh_get_progname(argv[0]); 290 __progname = ssh_get_progname(argv[0]);
285 291
286 memset(&args, '\0', sizeof(args)); 292 memset(&args, '\0', sizeof(args));