httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jerenkra...@apache.org
Subject cvs commit: apache-1.3/src/main http_core.c
Date Mon, 18 Nov 2002 19:24:23 GMT
jerenkrantz    2002/11/18 11:24:23

  Modified:    src/main http_core.c
  Log:
  We shouldn't be assigning the output of strtol to an unsigned short.  So,
  we'll change port to be a long and then do the correct range checking and
  downcasting.
  
  Suggested by: Roy Fielding
  
  Revision  Changes    Path
  1.320     +4 -4      apache-1.3/src/main/http_core.c
  
  Index: http_core.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/main/http_core.c,v
  retrieving revision 1.319
  retrieving revision 1.320
  diff -u -u -r1.319 -r1.320
  --- http_core.c	17 Nov 2002 22:29:14 -0000	1.319
  +++ http_core.c	18 Nov 2002 19:24:23 -0000	1.320
  @@ -2597,7 +2597,7 @@
   {
       listen_rec *new;
       char *ports, *endptr;
  -    unsigned short port;
  +    long port;
       
       const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
       if (err != NULL) {
  @@ -2627,10 +2627,10 @@
   	new->local_addr.sin_addr.s_addr = ap_get_virthost_addr(ips, NULL);
       }
       port = ap_strtol(ports, &endptr, 10);
  -    if (errno || (endptr && *endptr) || !port) {
  -	return "Missing or non-numeric port";
  +    if (errno || (endptr && *endptr) || port < 1 || port > 65535) {
  +	return "Missing, invalid, or non-numeric port";
       }
  -    new->local_addr.sin_port = htons(port);
  +    new->local_addr.sin_port = htons((unsigned short)port);
       new->fd = -1;
       new->used = 0;
       new->next = ap_listeners;
  
  
  

Mime
View raw message