From 19066a112baff6107781dc337b27e557f43098c2 Mon Sep 17 00:00:00 2001 From: Ben Lindstrom Date: Thu, 12 Apr 2001 23:39:26 +0000 Subject: - stevesk@cvs.openbsd.org 2001/04/12 20:09:38 [misc.c misc.h readconf.c servconf.c ssh.c sshd.c] robust port validation; ok markus@ jakob@ --- sshd.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'sshd.c') diff --git a/sshd.c b/sshd.c index bde1ac344..eaf3d322a 100644 --- a/sshd.c +++ b/sshd.c @@ -40,7 +40,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: sshd.c,v 1.192 2001/04/11 16:25:30 lebel Exp $"); +RCSID("$OpenBSD: sshd.c,v 1.193 2001/04/12 20:09:38 stevesk Exp $"); #include #include @@ -611,7 +611,11 @@ main(int ac, char **av) fprintf(stderr, "too many ports.\n"); exit(1); } - options.ports[options.num_ports++] = atoi(optarg); + options.ports[options.num_ports++] = a2port(optarg); + if (options.ports[options.num_ports-1] == 0) { + fprintf(stderr, "Bad port number.\n"); + exit(1); + } break; case 'g': options.login_grace_time = atoi(optarg); -- cgit v1.2.3