diff options
author | 2001-04-12 20:09:36 +0000 | |
---|---|---|
committer | 2001-04-12 20:09:36 +0000 | |
commit | dddd58cea3efc2d72740c89271c27e2371a979db (patch) | |
tree | 294184c21561071fc0ab8205a0a73b7d2a2032c9 /usr.bin/ssh/ssh.c | |
parent | typo (diff) | |
download | wireguard-openbsd-dddd58cea3efc2d72740c89271c27e2371a979db.tar.xz wireguard-openbsd-dddd58cea3efc2d72740c89271c27e2371a979db.zip |
robust port validation; ok markus@ jakob@
Diffstat (limited to 'usr.bin/ssh/ssh.c')
-rw-r--r-- | usr.bin/ssh/ssh.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/usr.bin/ssh/ssh.c b/usr.bin/ssh/ssh.c index 2282eb5ae76..6fd34f94add 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.112 2001/04/12 19:15:25 markus Exp $"); +RCSID("$OpenBSD: ssh.c,v 1.113 2001/04/12 20:09:37 stevesk Exp $"); #include <openssl/evp.h> #include <openssl/err.h> @@ -239,7 +239,7 @@ main(int ac, char **av) { int i, opt, optind, exit_status, ok; u_short fwd_port, fwd_host_port; - char *optarg, *cp, *endofnumber, buf[256]; + char *optarg, *cp, buf[256]; struct stat st; struct passwd *pw; int dummy; @@ -447,8 +447,8 @@ main(int ac, char **av) } break; case 'p': - options.port = strtol(optarg, &endofnumber, 0); - if (optarg == endofnumber) { + options.port = a2port(optarg); + if (options.port == 0) { fprintf(stderr, "Bad port '%s'\n", optarg); exit(1); } @@ -480,9 +480,9 @@ main(int ac, char **av) break; case 'D': - fwd_port = strtol(optarg, &endofnumber, 0); - if (optarg == endofnumber) { - fprintf(stderr, "Bad port '%s'\n", optarg); + fwd_port = a2port(optarg); + if (fwd_port == 0) { + fprintf(stderr, "Bad dynamic port '%s'\n", optarg); exit(1); } add_local_forward(&options, fwd_port, "socks4", 0); |