Re: [PATCH] Stop depending on strndupa.

2020-10-26 Thread Dmitry V. Levin
On Mon, Oct 26, 2020 at 11:51:21AM -0300, Érico Nogueira via Elfutils-devel wrote: [...] > +error (EXIT_FAILURE, 0, _("path is too long '%s'"), path); I suggest the following alternative: error (EXIT_FAILURE, ENAMETOOLONG, "%s", path); -- ldv

[PATCH] Stop depending on strndupa.

2020-10-26 Thread Érico Nogueira via Elfutils-devel
From: Érico Rolim This functon has inherent safety issues, since a long enough path can lead to memory clobbering. Instead, limit the path length to PATH_MAX. As a bonus, this improves musl compatibility, since musl doesn't include the strndupa macro for now. Also add braces around while loop.