[Cherokee-commits] rev 1542 - in cherokee/trunk

cherokee at cherokee-project.com cherokee at cherokee-project.com
Thu Jun 12 18:31:22 CEST 2008


Author: alo
Date: 2008-06-12 18:31:22 +0200 (Thu, 12 Jun 2008)
New Revision: 1542
Log:

Get the changeset with:
  svn diff -r 1541:1542 svn://svn.cherokee-project.com/

Modified:
  cherokee/trunk/ChangeLog
    4 ++++
  cherokee/trunk/cherokee/main.c
   15 ++++++++++++++-

Modified: cherokee/trunk/ChangeLog
===================================================================
--- cherokee/trunk/ChangeLog	2008-06-12 14:56:31 UTC (rev 1541)
+++ cherokee/trunk/ChangeLog	2008-06-12 16:31:22 UTC (rev 1542)
@@ -1,5 +1,9 @@
 2008-06-12  Alvaro Lopez Ortega  <alvaro at alobbs.com>
 
+	* cherokee/main.c (common_server_initialization): Added a check to
+	ensure that the TCP port is within the limits. It fixes:
+	http://code.google.com/p/cherokee/issues/detail?id=43
+
 	* configure.in: Fixes an issue with the license notice. Reported
 	by Tim Post <echo at echoreply.us>.
 

Modified: cherokee/trunk/cherokee/main.c
===================================================================
--- cherokee/trunk/cherokee/main.c	2008-06-12 14:56:31 UTC (rev 1541)
+++ cherokee/trunk/cherokee/main.c	2008-06-12 16:31:22 UTC (rev 1542)
@@ -152,11 +152,22 @@
 	if (document_root != NULL) {
 		cherokee_buffer_t tmp = CHEROKEE_BUF_INIT;
 
+		/* Sanity check
+		 */
+		if (port > 0xFFFF) {
+			PRINT_ERROR ("Port %d is out of limits\n", port);
+			return ret_error;
+		}
+
+		/* Build the configuration string
+		 */
 		cherokee_buffer_add_va (&tmp, 
 					"server!port = %d\n"
 					"vserver!default!document_root = %s\n"
 					BASIC_CONFIG, port, document_root);
 
+		/* Apply it
+		 */
 		ret = cherokee_server_read_config_string (srv, &tmp);
 		cherokee_buffer_mrproper (&tmp);
 
@@ -167,7 +178,9 @@
 
 	} else {
 		char *config;
-
+		
+		/* Read the configuration file
+		 */
 		config = (config_file) ? config_file : DEFAULT_CONFIG_FILE;
 		ret = cherokee_server_read_config_file (srv, config);
 




More information about the Cherokee-commits mailing list