- djm@cvs.openbsd.org 2006/04/01 05:50:29

[scp.c]
     xasprintification; ok deraadt@
This commit is contained in:
Damien Miller 2006-04-23 12:04:46 +10:00
parent 07aa132a5e
commit 7a656f7922
2 changed files with 7 additions and 10 deletions

View File

@ -3,6 +3,9 @@
- deraadt@cvs.openbsd.org 2006/04/01 05:42:20 - deraadt@cvs.openbsd.org 2006/04/01 05:42:20
[scp.c] [scp.c]
minimal lint cleanup (unused crud, and some size_t); ok djm minimal lint cleanup (unused crud, and some size_t); ok djm
- djm@cvs.openbsd.org 2006/04/01 05:50:29
[scp.c]
xasprintification; ok deraadt@
20060421 20060421
- (djm) [Makefile.in configure.ac session.c sshpty.c] - (djm) [Makefile.in configure.ac session.c sshpty.c]
@ -4514,4 +4517,4 @@
- (djm) Trim deprecated options from INSTALL. Mention UsePAM - (djm) Trim deprecated options from INSTALL. Mention UsePAM
- (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu
$Id: ChangeLog,v 1.4303 2006/04/23 02:04:27 djm Exp $ $Id: ChangeLog,v 1.4304 2006/04/23 02:04:46 djm Exp $

12
scp.c
View File

@ -1,4 +1,4 @@
/* $OpenBSD: scp.c,v 1.140 2006/04/01 05:42:20 deraadt Exp $ */ /* $OpenBSD: scp.c,v 1.141 2006/04/01 05:50:29 djm Exp $ */
/* /*
* scp - secure remote copy. This is basically patched BSD rcp which * scp - secure remote copy. This is basically patched BSD rcp which
* uses ssh to do the data transfer (instead of using rcmd). * uses ssh to do the data transfer (instead of using rcmd).
@ -422,7 +422,6 @@ toremote(char *targ, int argc, char **argv)
{ {
char *bp, *host, *src, *suser, *thost, *tuser, *arg; char *bp, *host, *src, *suser, *thost, *tuser, *arg;
arglist alist; arglist alist;
size_t len;
int i; int i;
memset(&alist, '\0', sizeof(alist)); memset(&alist, '\0', sizeof(alist));
@ -488,9 +487,7 @@ toremote(char *targ, int argc, char **argv)
errs = 1; errs = 1;
} else { /* local to remote */ } else { /* local to remote */
if (remin == -1) { if (remin == -1) {
len = strlen(targ) + CMDNEEDS + 20; xasprintf(&bp, "%s -t %s", cmd, targ);
bp = xmalloc(len);
(void) snprintf(bp, len, "%s -t %s", cmd, targ);
host = cleanhostname(thost); host = cleanhostname(thost);
if (do_cmd(host, tuser, bp, &remin, if (do_cmd(host, tuser, bp, &remin,
&remout) < 0) &remout) < 0)
@ -509,7 +506,6 @@ tolocal(int argc, char **argv)
{ {
char *bp, *host, *src, *suser; char *bp, *host, *src, *suser;
arglist alist; arglist alist;
size_t len;
int i; int i;
memset(&alist, '\0', sizeof(alist)); memset(&alist, '\0', sizeof(alist));
@ -542,9 +538,7 @@ tolocal(int argc, char **argv)
suser = pwd->pw_name; suser = pwd->pw_name;
} }
host = cleanhostname(host); host = cleanhostname(host);
len = strlen(src) + CMDNEEDS + 20; xasprintf(&bp, "%s -f %s", cmd, src);
bp = xmalloc(len);
(void) snprintf(bp, len, "%s -f %s", cmd, src);
if (do_cmd(host, suser, bp, &remin, &remout) < 0) { if (do_cmd(host, suser, bp, &remin, &remout) < 0) {
(void) xfree(bp); (void) xfree(bp);
++errs; ++errs;