[PATCH] Fix string to integer conversion

Ralph Böhme slow at samba.org
Mon Feb 25 21:47:54 UTC 2019


N'Abend! :)

> Am 25.02.2019 um 21:10 schrieb Volker Lendecke <Volker.Lendecke at SerNet.DE>:
> 
> On Mon, Feb 25, 2019 at 06:56:18PM +0100, Ralph Böhme via samba-technical wrote:
>> The strtoul API is broken and we shouldn't add it to Samba. I know it's a
>> pita to change the many callers once again, I'm willing to lend a helping
>> hand here.
> 
> Maybe looking somewhere else helps: What about
> 
> https://man.openbsd.org/strtonum.3

that's going in the right direction in giving an reliable error for the "The string did not consist solely of digit characters." case. Though I wonder if that applies to the empty string as well. Arguably the empty string could be seen as a string that does not "consist solely of digit characters." 

I think checking for upper and lower bounds can be done in the caller, most existing callers don't need this iirc.

> as an API? Although this might start to become a discussion about the
> color of the bike-shed. Ours is transparent by the way. Go looking for
> it on
> 
> https://www.google.de/maps/@51.536622,9.9231612,3a,30y,67.77h,92.42t/data=!3m8!1e1!3m6!1sAF1QipPnfcnS9T_sR3j4E0x_y407vmQaev8UmEDk93_s!2e10!3e11!6shttps:%2F%2Flh5.googleusercontent.com%2Fp%2FAF1QipPnfcnS9T_sR3j4E0x_y407vmQaev8UmEDk93_s%3Dw203-h100-k-no-pi-0-ya51.086464-ro-0-fo100!7i8704!8i4352
> 
> :-)

"Da ist keine Butter!". :)))

-slow


More information about the samba-technical mailing list