diff options
author | Markus Friedl <markus@cvs.openbsd.org> | 2001-04-11 10:59:02 +0000 |
---|---|---|
committer | Markus Friedl <markus@cvs.openbsd.org> | 2001-04-11 10:59:02 +0000 |
commit | 474ddc8277081e76b780b7c049c6d5c463e6887a (patch) | |
tree | 80b6416d62a036e04c47edfd79dfc1f13936c057 /usr.bin/ssh | |
parent | f5452e0e3990097e86f5acc0289f93dbbe8be42b (diff) |
use strtol() for ports, thanks jakob@
Diffstat (limited to 'usr.bin/ssh')
-rw-r--r-- | usr.bin/ssh/ssh.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/usr.bin/ssh/ssh.c b/usr.bin/ssh/ssh.c index c6a38003772..68658acaf98 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.108 2001/04/07 08:55:18 markus Exp $"); +RCSID("$OpenBSD: ssh.c,v 1.109 2001/04/11 10:59:01 markus Exp $"); #include <openssl/evp.h> #include <openssl/err.h> @@ -235,7 +235,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, *cp, *endofnumber, buf[256]; struct stat st; struct passwd *pw; int dummy; @@ -443,7 +443,11 @@ main(int ac, char **av) } break; case 'p': - options.port = atoi(optarg); + options.port = strtol(optarg, &endofnumber, 0); + if (optarg == endofnumber) { + fprintf(stderr, "Bad port '%s'\n", optarg); + exit(1); + } break; case 'l': options.user = optarg; @@ -472,7 +476,11 @@ main(int ac, char **av) break; case 'D': - fwd_port = atoi(optarg); + fwd_port = strtol(optarg, &endofnumber, 0); + if (optarg == endofnumber) { + fprintf(stderr, "Bad port '%s'\n", optarg); + exit(1); + } add_local_forward(&options, fwd_port, "socks4", 0); break; |