On Thu, Jul 25, 2024 at 06:39:53PM GMT, Alejandro Colomar wrote:
> Hi Paul,
> 
> On Thu, Jul 25, 2024 at 07:55:15AM GMT, Paul Eggert wrote:
> > On 2024-07-25 02:27, Alejandro Colomar wrote:
> > > -  tmp = 1;
> > > 
> > >   We will multiply the base by 1, even if it wasn't in the string.
> > 
> > I don't see that. There's no multiplication of BASE by 1 in "tmp = 1;".
> 
> D'oh, sorry for the wording, I was using base because the variable used
> is xbase, but the more appropriate term would be power, as in powers of
> ten or 1024.
> 
> So, we have arrived there, tmp is 1, and the suffix is "k", so it will
> be multiplied by 1000.
> 
> > > I don't understand too much the rest of xstrtol(), but I think it will
> > > successfully parse 1000, when it should have failed.
> > 
> > There's no reason xstrtol should fail in that situation.
> 
> I passed a base of -1.  Remember the call was
> 
>       xstrtol("k", &end, -1, ...);

If you can, test such a call in a glibc system, which will fail, and
test it on a BSD, which will parse 1000 (I expect).

> 
> That should result in EINVAL.
> 
> Cheers,
> Alex
> 
> -- 
> <https://www.alejandro-colomar.es/>



-- 
<https://www.alejandro-colomar.es/>

Attachment: signature.asc
Description: PGP signature

Reply via email to