diff options
Diffstat (limited to 'scp.c')
-rw-r--r-- | scp.c | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -71,7 +71,7 @@ | |||
71 | */ | 71 | */ |
72 | 72 | ||
73 | #include "includes.h" | 73 | #include "includes.h" |
74 | RCSID("$OpenBSD: scp.c,v 1.119 2005/01/24 10:22:06 dtucker Exp $"); | 74 | RCSID("$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 | |||
361 | toremote(char *targ, int argc, char **argv) | 361 | toremote(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 | ||