[PATCH] string_to_number issue

Harald Welte laforge@gnumonks.org
Sun, 22 Jul 2001 12:34:56 -0300


On Sun, Jul 22, 2001 at 07:35:00AM -0400, Brad Chapman wrote:
> Everyone,
> 
>    Here is a patch which _finally_ fixes the string_to_number
> issue. According to strtoul(3) for my glibc library, it will
> perform negation of the converted value before returning it. I
> just hope this is the case for glibc (and other C libraries)
> everywhere.

I'm afraid that this will not fix the problem.

The issue is, that the function returns -1 as a return value for failure.

and there is no difference between the legal value "-1" of a signed int, and
the error case.

and if you talk about counters, etc. you will very fast run into unsigned ints.

I'm going to fix this issue now in CVS.

> Brad

-- 
Live long and prosper
- Harald Welte / laforge@gnumonks.org                http://www.gnumonks.org
============================================================================
GCS/E/IT d- s-: a-- C+++ UL++++$ P+++ L++++$ E--- W- N++ o? K- w--- O- M- 
V-- PS+ PE-- Y+ PGP++ t++ 5-- !X !R tv-- b+++ DI? !D G+ e* h+ r% y+(*)