summaryrefslogtreecommitdiffstats
path: root/ssh.c
diff options
context:
space:
mode:
authorBen Lindstrom <mouring@eviladmin.org>2001-04-12 01:06:28 +0200
committerBen Lindstrom <mouring@eviladmin.org>2001-04-12 01:06:28 +0200
commit146edb98324111ce29ca266221abb1514aacfe24 (patch)
tree489d13082886b854b85e2ca42adb2cc920095b67 /ssh.c
parent - djm@cvs.openbsd.org 2001/04/11 07:06:22 (diff)
downloadopenssh-146edb98324111ce29ca266221abb1514aacfe24.tar.xz
openssh-146edb98324111ce29ca266221abb1514aacfe24.zip
- markus@cvs.openbsd.org 2001/04/11 10:59:01
[ssh.c] use strtol() for ports, thanks jakob@
Diffstat (limited to '')
-rw-r--r--ssh.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/ssh.c b/ssh.c
index 75094a106..89ced97e2 100644
--- a/ssh.c
+++ b/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>
@@ -243,7 +243,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;
@@ -456,7 +456,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;
@@ -485,7 +489,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;