- markus@cvs.openbsd.org 2001/06/22 23:35:21
[ssh.c]
don't overwrite argv (fixes ssh user@host in 'ps'), report by ericj@
diff --git a/ChangeLog b/ChangeLog
index a6d3db5..b733b46 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -32,6 +32,9 @@
- markus@cvs.openbsd.org 2001/06/22 22:21:20
[sftp-server.c]
allow long usernames/groups in readdir
+ - markus@cvs.openbsd.org 2001/06/22 23:35:21
+ [ssh.c]
+ don't overwrite argv (fixes ssh user@host in 'ps'), report by ericj@
20010622
- (stevesk) handle systems without pw_expire and pw_change.
@@ -5716,4 +5719,4 @@
- Wrote replacements for strlcpy and mkdtemp
- Released 1.0pre1
-$Id: ChangeLog,v 1.1304 2001/06/25 04:24:49 mouring Exp $
+$Id: ChangeLog,v 1.1305 2001/06/25 04:26:55 mouring Exp $
diff --git a/ssh.c b/ssh.c
index 4859c5b..e0e141f 100644
--- a/ssh.c
+++ b/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>
@@ -244,7 +244,7 @@
{
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;
@@ -305,10 +305,12 @@
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