httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marc Slemko <ma...@worldgate.com>
Subject Re: before 1.3b3...
Date Thu, 13 Nov 1997 15:28:10 GMT
On Thu, 13 Nov 1997, Martin Kraemer wrote:

> On Thu, Nov 13, 1997 at 07:43:50AM -0700, Marc Slemko wrote:
> > I was thinking that since the patch uses strtoul, there must be some
> > reason; if that is the case, you can't just change it.
> 
> Since I was the author of the locations where strtoul() is used, maybe I
> should explain:
> 
> No, the reason for strtoul() use was not that the numbers should not
> overflow at the top end, but to document that the input is supposed to
> be _positive_ (i.e., an IP addr like -123.-45.-67.-89 is _not_ regarded
> to be valid input). Both atoi() and strtol() are supposed to accept such
> an input and deliver the results (-123 etc.). Strtoul() IMO should
> not accept negative numbers as valid (though it does on Linux).
> 
> The idea really was to document the intention.
> 
> However, when strtoul() is not available, and the extra (intended) input
> check is not required because the input is valid anyway, then strtol()
> makes a perfect replacement.

Problem is that I doubt we know all platforms where strtoul is around.

Why not just check what strtol returns and, if it is negative, say "gaa!"?
Gives better checking than strtoul.  In fact, check for 0 <= octet <=
255...

> 
>     Martin
> 
> > On Thu, 13 Nov 1997, Martin Kraemer wrote:
> > > Therefore just use this:
> > > 
> > > #ifdef SUNOS4
> > > #define strtoul(numstr,endp,base)  (unsigned long)strtol(numstr,endp,base)
> > > #endif
> -- 
> | S I E M E N S |  <Martin.Kraemer@mch.sni.de>  |      Siemens Nixdorf
> | ------------- |   Voice: +49-89-636-46021     |  Informationssysteme AG
> | N I X D O R F |   FAX:   +49-89-636-44994     |   81730 Munich, Germany
> ~~~~~~~~~~~~~~~~My opinions only, of course; pgp key available on request
> 


Mime
View raw message