diff options
author | 2001-06-22 23:35:21 +0000 | |
---|---|---|
committer | 2001-06-22 23:35:21 +0000 | |
commit | a53c7ffe06fd1346e32347ee4a51db08f858716a (patch) | |
tree | 9cb435a4c15b05931619ceedf3e709174d21c420 /usr.bin/ssh/ssh.c | |
parent | tweak (diff) | |
download | wireguard-openbsd-a53c7ffe06fd1346e32347ee4a51db08f858716a.tar.xz wireguard-openbsd-a53c7ffe06fd1346e32347ee4a51db08f858716a.zip |
don't overwrite argv (fixes ssh user@host in 'ps'), report by ericj@
Diffstat (limited to 'usr.bin/ssh/ssh.c')
-rw-r--r-- | usr.bin/ssh/ssh.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/usr.bin/ssh/ssh.c b/usr.bin/ssh/ssh.c index 9a5c6d1761a..584a7c3735e 100644 --- a/usr.bin/ssh/ssh.c +++ b/usr.bin/ssh/ssh.c @@ -39,7 +39,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: ssh.c,v 1.124 2001/06/07 20:23:05 markus Exp $"); +RCSID("$OpenBSD: ssh.c,v 1.125 2001/06/22 23:35:21 markus Exp $"); #include <openssl/evp.h> #include <openssl/err.h> @@ -236,7 +236,7 @@ main(int ac, char **av) { int i, opt, optind, exit_status, ok; u_short fwd_port, fwd_host_port; - char *optarg, *cp, buf[256]; + char *optarg, *p, *cp, buf[256]; struct stat st; struct passwd *pw; int dummy; @@ -292,10 +292,12 @@ main(int ac, char **av) if (av[optind][0] != '-') { if (host) break; - if ((cp = strchr(av[optind], '@'))) { - if(cp == av[optind]) + if (strchr(av[optind], '@')) { + p = xstrdup(av[optind]); + cp = strchr(p, '@'); + if(cp == NULL || cp == p) usage(); - options.user = av[optind]; + options.user = p; *cp = '\0'; host = ++cp; } else |