httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m...@hyperreal.org
Subject cvs commit: apachen/src/modules/proxy proxy_util.c
Date Fri, 14 Nov 1997 15:59:18 GMT
marc        97/11/14 07:59:18

  Modified:    src/modules/proxy proxy_util.c
  Log:
  Remove strtoul() use from mod_proxy since it can be done a different
  way and isn't portable.
  
  PR: 1214
  Reviewed by:	Dean Gaudet, Martin Kraemer, Jim Jagielski
  
  Revision  Changes    Path
  1.36      +10 -5     apachen/src/modules/proxy/proxy_util.c
  
  Index: proxy_util.c
  ===================================================================
  RCS file: /export/home/cvs/apachen/src/modules/proxy/proxy_util.c,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- proxy_util.c	1997/11/01 21:13:24	1.35
  +++ proxy_util.c	1997/11/14 15:59:17	1.36
  @@ -867,9 +867,9 @@
   int proxy_is_ipaddr(struct dirconn_entry *This)
   {
       const char *addr = This->name;
  -    unsigned long ip_addr[4];
  +    long ip_addr[4];
       int i, quads;
  -    unsigned long bits;
  +    long bits;
   
       /* if the address is given with an explicit netmask, use that */
       /* Due to a deficiency in ap_inet_addr(), it is impossible to parse */
  @@ -900,11 +900,16 @@
   	if (!isdigit(*addr))
   	    return 0;		/* no digit at start of quad */
   
  -	ip_addr[quads] = strtoul(addr, &tmp, 0);
  +	ip_addr[quads] = strtol(addr, &tmp, 0);
   
   	if (tmp == addr)	/* expected a digit, found something else */
   	    return 0;
   
  +	if (ip_addr[quads] < 0 || ip_addr[quads] > 255) {
  +	    /* invalid octet */
  +	    return 0;
  +	}
  +
   	addr = tmp;
   
   	if (*addr == '.' && quads != 3)
  @@ -919,14 +924,14 @@
   
   	++addr;
   
  -	bits = strtoul(addr, &tmp, 0);
  +	bits = strtol(addr, &tmp, 0);
   
   	if (tmp == addr)	/* expected a digit, found something else */
   	    return 0;
   
   	addr = tmp;
   
  -	if (bits > 32)		/* netmask must be between 0 and 32 */
  +	if (bits < 0 || bits > 32)	/* netmask must be between 0 and 32 */
   	    return 0;
   
       }
  
  
  

Mime
View raw message