Hi Mark,

On Tue, Aug 19, 2025 at 1:24 PM Mark Wielaard <m...@klomp.org> wrote:
> > +  /* Allocate copies of ar_name and ar_rawname.  */
> > +  size_t name_len = strlen (ar_name) + 1;
> > +  char *name_copy = malloc (MAX (name_len, 16));
>
> There is actually a strnlen that does that (MAX) in one step.

MAX is used to ensure the buffer is at least 16 bytes. This is done to
match the existing format of Elf_Arhdr ar_name, which points to either
a 16 byte buffer or a name in the long names array exceeding 16 bytes.
strnlen (ar_name, 16) would cut off part of a long name.

> [...]
> Looks good. Please take a look at the strnlen nitpick above. But that
> is just a little optimization.

Thanks, pushed as commit cc459edfe10f. I left the usage of MAX as is.

Aaron

Reply via email to