rse 98/03/13 08:54:21
Modified: src/main http_core.c
Log:
Make sure the given argument to "Port" is in the appropriate range.
Submitted by: Ben Hyde
Reviewed by: Ralf S. Engelschall
Revision Changes Path
1.168 +9 -2 apache-1.3/src/main/http_core.c
Index: http_core.c
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/main/http_core.c,v
retrieving revision 1.167
retrieving revision 1.168
diff -u -r1.167 -r1.168
--- http_core.c 1998/03/13 16:49:41 1.167
+++ http_core.c 1998/03/13 16:54:15 1.168
@@ -1286,9 +1286,16 @@
static const char *server_port (cmd_parms *cmd, void *dummy, char *arg)
{
const char *err = check_cmd_context(cmd,
NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT);
- if (err != NULL) return err;
+ int port;
- cmd->server->port = atoi (arg);
+ if (err != NULL)
+ return err;
+ port = atoi(arg);
+ if (port <= 0 || port >= 65536) /* 65536 == 1<<16 */
+ return pstrcat(cmd->temp_pool, "The port number \"", arg,
+ "\" is outside the appropriate range (i.e. 1..65535).",
+ NULL);
+ cmd->server->port = port;
return NULL;
}