summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMukund Sivaraman <muks@banu.com>2011-03-04 14:07:07 +0530
committerMukund Sivaraman <muks@banu.com>2011-03-04 14:07:07 +0530
commit97b9984484299b2ce72f8f4fc3706dab8a3a8439 (patch)
tree817268f70f587657fe841ee814b997e812587f34
parent5ad24ba99d46170513e18d615a65f835ca42e5e7 (diff)
downloadtinyproxy-97b9984484299b2ce72f8f4fc3706dab8a3a8439.tar.gz
tinyproxy-97b9984484299b2ce72f8f4fc3706dab8a3a8439.zip
Validate port number specified in Port directive
This was asked in bug #90 comment #8.
-rw-r--r--src/conf.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/conf.c b/src/conf.c
index b16b8e9..59630a2 100644
--- a/src/conf.c
+++ b/src/conf.c
@@ -779,7 +779,15 @@ static HANDLE_FUNC (handle_bindsame)
static HANDLE_FUNC (handle_port)
{
- return set_int_arg (&conf->port, line, &match[2]);
+ set_int_arg (&conf->port, line, &match[2]);
+
+ if (conf->port > 65535) {
+ fprintf (stderr, "Bad port number (%d) supplied for Port.\n",
+ conf->port);
+ return 1;
+ }
+
+ return 0;
}
static HANDLE_FUNC (handle_maxclients)