httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aa...@apache.org
Subject cvs commit: apache-1.3/src/main http_core.c
Date Wed, 20 Nov 2002 22:38:26 GMT
aaron       2002/11/20 14:38:26

  Modified:    src/main http_core.c
  Log:
  Clear errno before calling strtol, and add in some comments.
  
  Obtained from:  Philippe M. Chiasson <gozer@cpan.org>,
                  Geoffrey Young <geoff@modperlcookbook.org>
  Submitted by:	Aaron Bannert
  
  Revision  Changes    Path
  1.321     +5 -1      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.320
  retrieving revision 1.321
  diff -u -r1.320 -r1.321
  --- http_core.c	18 Nov 2002 19:24:23 -0000	1.320
  +++ http_core.c	20 Nov 2002 22:38:26 -0000	1.321
  @@ -2626,8 +2626,12 @@
       else {
   	new->local_addr.sin_addr.s_addr = ap_get_virthost_addr(ips, NULL);
       }
  +    errno = 0; /* clear errno before calling strtol */
       port = ap_strtol(ports, &endptr, 10);
  -    if (errno || (endptr && *endptr) || port < 1 || port > 65535) {
  +    if (errno /* some sort of error */
  +       || (endptr && *endptr) /* make sure no trailing characters */
  +       || port < 1 || port > 65535) /* underflow/overflow */
  +    {
   	return "Missing, invalid, or non-numeric port";
       }
       new->local_addr.sin_port = htons((unsigned short)port);
  
  
  

Mime
View raw message