summaryrefslogtreecommitdiff
path: root/usr.bin/ssh/ssh.c
diff options
context:
space:
mode:
authorKevin Steves <stevesk@cvs.openbsd.org>2001-04-12 20:09:39 +0000
committerKevin Steves <stevesk@cvs.openbsd.org>2001-04-12 20:09:39 +0000
commite57cfb6e67a9083afbbf8ef90cc40f20f3cc0cae (patch)
tree9c6a40aa55acc3e7cd847d65b01b96fc26a1ad9a /usr.bin/ssh/ssh.c
parent16b07b0d75cefdf012d4d5121c56a888154ae47d (diff)
robust port validation; ok markus@ jakob@
Diffstat (limited to 'usr.bin/ssh/ssh.c')
-rw-r--r--usr.bin/ssh/ssh.c14
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);