summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorericj <>2001-06-27 07:23:58 +0000
committerericj <>2001-06-27 07:23:58 +0000
commitffd66982d4c93fc099b5e4a666cd36fb7f4c3bd9 (patch)
tree59eb86b75e2b4cf59de0dc39bf79a18402ad39bc /src
parent0891d6e7daa2cc7f8a18bbf489678e810828e124 (diff)
downloadopenbsd-ffd66982d4c93fc099b5e4a666cd36fb7f4c3bd9.tar.gz
openbsd-ffd66982d4c93fc099b5e4a666cd36fb7f4c3bd9.tar.bz2
openbsd-ffd66982d4c93fc099b5e4a666cd36fb7f4c3bd9.zip
more magic stuff to define's
Diffstat (limited to 'src')
-rw-r--r--src/usr.bin/nc/netcat.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/usr.bin/nc/netcat.c b/src/usr.bin/nc/netcat.c
index a64d156379..6c516428fd 100644
--- a/src/usr.bin/nc/netcat.c
+++ b/src/usr.bin/nc/netcat.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: netcat.c,v 1.30 2001/06/27 03:14:28 smart Exp $ */ 1/* $OpenBSD: netcat.c,v 1.31 2001/06/27 07:23:58 ericj Exp $ */
2/* 2/*
3 * Copyright (c) 2001 Eric Jackson <ericj@monkey.org> 3 * Copyright (c) 2001 Eric Jackson <ericj@monkey.org>
4 * 4 *
@@ -48,6 +48,8 @@
48#include <string.h> 48#include <string.h>
49#include <unistd.h> 49#include <unistd.h>
50 50
51#define PORT_MAX 65535
52
51/* Command Line Options */ 53/* Command Line Options */
52int iflag; /* Interval Flag */ 54int iflag; /* Interval Flag */
53int kflag; /* More than one connect */ 55int kflag; /* More than one connect */
@@ -63,10 +65,9 @@ int zflag; /* Port Scan Flag */
63 65
64int timeout; 66int timeout;
65int family = AF_UNSPEC; 67int family = AF_UNSPEC;
66char *portlist[65535]; 68char *portlist[PORT_MAX];
67 69
68ssize_t atomicio __P((ssize_t (*)(), int, void *, size_t)); 70ssize_t atomicio __P((ssize_t (*)(), int, void *, size_t));
69
70void atelnet __P((int, unsigned char *, unsigned int)); 71void atelnet __P((int, unsigned char *, unsigned int));
71void build_ports __P((char *)); 72void build_ports __P((char *));
72void help __P((void)); 73void help __P((void));
@@ -503,10 +504,10 @@ build_ports(p)
503 504
504 /* Make sure the ports are in order: lowest->highest */ 505 /* Make sure the ports are in order: lowest->highest */
505 hi = (int)strtoul(n, &endp, 10); 506 hi = (int)strtoul(n, &endp, 10);
506 if (hi <= 0 || hi > 65535 || *endp != '\0') 507 if (hi <= 0 || hi > PORT_MAX || *endp != '\0')
507 errx(1, "port range not valid"); 508 errx(1, "port range not valid");
508 lo = (int)strtoul(p, &endp, 10); 509 lo = (int)strtoul(p, &endp, 10);
509 if (lo <= 0 || lo > 65535 || *endp != '\0') 510 if (lo <= 0 || lo > PORT_MAX || *endp != '\0')
510 errx(1, "port range not valid"); 511 errx(1, "port range not valid");
511 512
512 if (lo > hi) { 513 if (lo > hi) {
@@ -517,7 +518,7 @@ build_ports(p)
517 518
518 /* Load ports sequentially */ 519 /* Load ports sequentially */
519 for (cp = lo; cp <= hi; cp++) { 520 for (cp = lo; cp <= hi; cp++) {
520 portlist[x] = malloc(sizeof(65535)); 521 portlist[x] = malloc(sizeof(PORT_MAX));
521 sprintf(portlist[x], "%d", cp); 522 sprintf(portlist[x], "%d", cp);
522 x++; 523 x++;
523 } 524 }
@@ -536,9 +537,9 @@ build_ports(p)
536 } 537 }
537 } else { 538 } else {
538 hi = (int)strtoul(p, &endp, 10); 539 hi = (int)strtoul(p, &endp, 10);
539 if (hi <= 0 || hi > 65535 || *endp != '\0') 540 if (hi <= 0 || hi > PORT_MAX || *endp != '\0')
540 errx(1, "port range not valid"); 541 errx(1, "port range not valid");
541 portlist[0] = malloc(sizeof(65535)); 542 portlist[0] = malloc(sizeof(PORT_MAX));
542 portlist[0] = p; 543 portlist[0] = p;
543 } 544 }
544} 545}