summaryrefslogtreecommitdiffstats
path: root/readconf.c
diff options
context:
space:
mode:
authorBen Lindstrom <mouring@eviladmin.org>2001-04-12 23:39:26 +0000
committerBen Lindstrom <mouring@eviladmin.org>2001-04-12 23:39:26 +0000
commit19066a112baff6107781dc337b27e557f43098c2 (patch)
tree55200517aa7e6912f8d623b4b8ef340dc9de6495 /readconf.c
parentd69dab3cde47c7e17382de556449bfda0fb28deb (diff)
- 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@
Diffstat (limited to 'readconf.c')
-rw-r--r--readconf.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/readconf.c b/readconf.c
index 144a7602..241185c6 100644
--- a/readconf.c
+++ b/readconf.c
@@ -12,7 +12,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: readconf.c,v 1.73 2001/04/12 19:39:27 markus Exp $");
+RCSID("$OpenBSD: readconf.c,v 1.74 2001/04/12 20:09:37 stevesk Exp $");
#include "ssh.h"
#include "xmalloc.h"
@@ -555,10 +555,10 @@ parse_int:
arg = strdelim(&s);
if (!arg || *arg == '\0')
fatal("%.200s line %d: Missing argument.", filename, linenum);
- if (arg[0] < '0' || arg[0] > '9')
+ fwd_port = a2port(arg);
+ if (fwd_port == 0)
fatal("%.200s line %d: Badly formatted port number.",
filename, linenum);
- fwd_port = atoi(arg);
arg = strdelim(&s);
if (!arg || *arg == '\0')
fatal("%.200s line %d: Missing second argument.",
@@ -574,10 +574,10 @@ parse_int:
arg = strdelim(&s);
if (!arg || *arg == '\0')
fatal("%.200s line %d: Missing argument.", filename, linenum);
- if (arg[0] < '0' || arg[0] > '9')
+ fwd_port = a2port(arg);
+ if (fwd_port == 0)
fatal("%.200s line %d: Badly formatted port number.",
filename, linenum);
- fwd_port = atoi(arg);
arg = strdelim(&s);
if (!arg || *arg == '\0')
fatal("%.200s line %d: Missing second argument.",
@@ -594,10 +594,10 @@ parse_int:
if (!arg || *arg == '\0')
fatal("%.200s line %d: Missing port argument.",
filename, linenum);
- if (arg[0] < '0' || arg[0] > '9')
+ fwd_port = a2port(arg);
+ if (fwd_port == 0)
fatal("%.200s line %d: Badly formatted port number.",
filename, linenum);
- fwd_port = atoi(arg);
add_local_forward(options, fwd_port, "socks4", 0);
break;