Re: [PATCH 2/2] libelf: Make sure ar_size starts with a digit before calling atol.

2022-03-18 Thread Evgeny Vereshchagin via Elfutils-devel
Hi Mark, > I guess the idea is that there could be an atoi implementation that > starts from the end of the string? But I think that is super unlikely > since atoi (and strtol) is defined on the initial portion of the > character array. The algorithm is described as working from the start > and on

Re: [PATCH 2/2] libelf: Make sure ar_size starts with a digit before calling atol.

2022-03-18 Thread Mark Wielaard
Hi Evgeny, On Fri, Mar 18, 2022 at 12:11:50PM +0300, Evgeny Vereshchagin wrote: > > The ar_size field is a 10 character string, not zero terminated, of > > decimal digits right padded with spaces. Make sure it actually starts > > with a digit before calling atol on it. We already make sure it is

Re: [PATCH 2/2] libelf: Make sure ar_size starts with a digit before calling atol.

2022-03-18 Thread Evgeny Vereshchagin
Hi, > The ar_size field is a 10 character string, not zero terminated, of > decimal digits right padded with spaces. Make sure it actually starts > with a digit before calling atol on it. We already make sure it is > zero terminated. Otherwise atol might produce unexpected results. As far as I

[PATCH 2/2] libelf: Make sure ar_size starts with a digit before calling atol.

2022-03-17 Thread Mark Wielaard
The ar_size field is a 10 character string, not zero terminated, of decimal digits right padded with spaces. Make sure it actually starts with a digit before calling atol on it. We already make sure it is zero terminated. Otherwise atol might produce unexpected results. Signed-off-by: Mark Wiela