- 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@
This commit is contained in:
Damien Miller 2006-07-10 22:19:53 +10:00
parent a1738e4c65
commit 3d1a9f4d5d
2 changed files with 15 additions and 4 deletions

View File

@ -87,6 +87,11 @@
[openbsd-compat/mktemp.c openbsd-compat/openbsd-compat.h]
[openbsd-compat/port-tun.c openbsd-compat/readpassphrase.c]
[openbsd-compat/xcrypt.c] Fix includes.h fallout, mainly fcntl.h
- OpenBSD CVS Sync
- 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@
20060706
- (dtucker) [configure.ac] Try AIX blibpath test in different order when
@ -4820,4 +4825,4 @@
- (djm) Trim deprecated options from INSTALL. Mention UsePAM
- (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu
$Id: ChangeLog,v 1.4381 2006/07/10 11:33:04 djm Exp $
$Id: ChangeLog,v 1.4382 2006/07/10 12:19:53 djm Exp $

12
scp.c
View File

@ -1,4 +1,4 @@
/* $OpenBSD: scp.c,v 1.144 2006/07/09 15:15:10 stevesk Exp $ */
/* $OpenBSD: scp.c,v 1.145 2006/07/10 12:03:20 djm Exp $ */
/*
* scp - secure remote copy. This is basically patched BSD rcp which
* uses ssh to do the data transfer (instead of using rcmd).
@ -272,15 +272,21 @@ void usage(void);
int
main(int argc, char **argv)
{
int ch, fflag, tflag, status;
int ch, fflag, tflag, status, n;
double speed;
char *targ, *endp;
char *targ, *endp, **newargv;
extern char *optarg;
extern int optind;
/* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */
sanitise_stdfd();
/* Copy argv, because we modify it */
newargv = xcalloc(MAX(argc + 1, 1), sizeof(*newargv));
for (n = 0; n < argc; n++)
newargv[n] = xstrdup(argv[n]);
argv = newargv;
__progname = ssh_get_progname(argv[0]);
memset(&args, '\0', sizeof(args));