Subject: Re: strtonum(3) in our libc
To: Mindaugas <unex@linija.org>
From: Bruce Korb <Bruce.Korb@gmail.com>
List: tech-userlevel
Date: 06/02/2006 19:29:40
Mindaugas wrote:

>Hi,
>some time ago OpenBSD developers implemented strtonum(3) function which
>is safer implementation of atoi(3) and strtol(3) - it does bounds
>checking, error detection, etc. They use it several applications (e.g.
>OpenSSH has native implementation).
>This function doesn't conform to POSIX or any other standard, but it
>might be useful. FreeBSD also made decision to import this function into
>the libc.
>
>If there is some questions about this, to don't discuss it twice,
>checkout discussion in FreeBSD mailing list with OpenBSD folks:
>http://lists.freebsd.org/pipermail/freebsd-current/2005-April/048655.html
>
>If there will be decision to import it, I attached patch and source with
>manual, which goes to src/lib/libc/stdlib :) Please review.
>  
>
If you are going to add a range checking layer over strtoll, *PLEASE* 
include
a variation that also has a base argument (and passed through to strtoll()).
  Thanks.