summaryrefslogtreecommitdiff
path: root/scp.c
diff options
context:
space:
mode:
Diffstat (limited to 'scp.c')
-rw-r--r--scp.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/scp.c b/scp.c
index f69fd05fc..dcea1946b 100644
--- a/scp.c
+++ b/scp.c
@@ -71,7 +71,7 @@
71 */ 71 */
72 72
73#include "includes.h" 73#include "includes.h"
74RCSID("$OpenBSD: scp.c,v 1.119 2005/01/24 10:22:06 dtucker Exp $"); 74RCSID("$OpenBSD: scp.c,v 1.120 2005/03/31 18:39:21 deraadt Exp $");
75 75
76#include "xmalloc.h" 76#include "xmalloc.h"
77#include "atomicio.h" 77#include "atomicio.h"
@@ -361,20 +361,23 @@ void
361toremote(char *targ, int argc, char **argv) 361toremote(char *targ, int argc, char **argv)
362{ 362{
363 int i, len; 363 int i, len;
364 char *bp, *host, *src, *suser, *thost, *tuser; 364 char *bp, *host, *src, *suser, *thost, *tuser, *arg;
365 365
366 *targ++ = 0; 366 *targ++ = 0;
367 if (*targ == 0) 367 if (*targ == 0)
368 targ = "."; 368 targ = ".";
369 369
370 if ((thost = strrchr(argv[argc - 1], '@'))) { 370 arg = strdup(argv[argc - 1]);
371 if (!arg)
372 err(1, "malloc");
373 if ((thost = strrchr(arg, '@'))) {
371 /* user@host */ 374 /* user@host */
372 *thost++ = 0; 375 *thost++ = 0;
373 tuser = argv[argc - 1]; 376 tuser = arg;
374 if (*tuser == '\0') 377 if (*tuser == '\0')
375 tuser = NULL; 378 tuser = NULL;
376 } else { 379 } else {
377 thost = argv[argc - 1]; 380 thost = arg;
378 tuser = NULL; 381 tuser = NULL;
379 } 382 }
380 383