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

>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:
>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* 
a variation that also has a base argument (and passed through to strtoll()).