summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorcertus certus@31f1291d-b8d6-0310-a050-a5561fc1590b <certus certus@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>2006-08-09 12:32:06 +0000
committercertus certus@31f1291d-b8d6-0310-a050-a5561fc1590b <certus certus@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>2006-08-09 12:32:06 +0000
commita512a8f9eb9fb6d20061af76cac7f0cecb5c5a4f (patch)
tree3273284ebc317d839ca4d6b3d40e87281bc4c0c7 /src
parentb7092e6bd1182473e40bffd32a2cf7b25f92b0bd (diff)
# BUILD : 1.7.15 (1129) # BUGS : 575 # NOTES : fixed port checking when using cmd line switches
git-svn-id: svn://svn.anope.org/anope/trunk@1130 31f1291d-b8d6-0310-a050-a5561fc1590b git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@853 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src')
-rw-r--r--src/init.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/init.c b/src/init.c
index e0dfe8086..b8ae80903 100644
--- a/src/init.c
+++ b/src/init.c
@@ -224,12 +224,14 @@ static int parse_options(int ac, char **av)
s = av[i];
t = strchr(s, ':');
if (t) {
+ int portnum;
*t++ = 0;
- if (atoi(t) > 0)
- RemotePort = atoi(t);
+ portnum = atoi(t);
+ if ((portnum > 0) && (portnum < 65535))
+ RemotePort = portnum;
else {
fprintf(stderr,
- "-remote: port number must be a positive integer. Using default.");
+ "-remote: Port numbers must be in the range 1..65535. Using default.\n");
return -1;
}
}
@@ -243,12 +245,14 @@ static int parse_options(int ac, char **av)
s = av[i];
t = strchr(s, ':');
if (t) {
+ int portnum;
*t++ = 0;
- if (atoi(t) >= 0)
- LocalPort = atoi(t);
+ portnum = atoi(t);
+ if ((portnum >= 0) && (portnum < 65535))
+ LocalPort = portnum;
else {
fprintf(stderr,
- "-local: port number must be a positive integer or 0. Using default.");
+ "-local: Port numbers must be in the range 1..65535 or 0. Using default.\n");
return -1;
}
}