Hi Érico,
On Mon, 2020-10-26 at 15:33 -0300, Érico Nogueira via Elfutils-devel
wrote:
> From: Érico Rolim <[email protected]>
>
> This functon has inherent safety issues, since a long enough path can
> lead to memory clobbering. Instead, limit the path length to
> PATH_MAX.
I like getting rid of strndupa, because it can accidentally blow up the
stack. But replacing it with an on stack array of PATH_MAX also carries
a risk of blowing up the stack because the function calls itself
recursively and now always uses a huge stack allocation for every
iteration. Can we simply use strndup and free (dir) when we are done
instead?
> Also add braces around while loop.
That is better, but note that GNU style is
while (...)
{
...
}
> Signed-off-by: Érico Rolim <[email protected]>
Thanks. Note that it is also missing a ChangeLog entry.
Cheers,
Mark