* Sergey Bugaev: > diff --git a/elf/ldconfig.c b/elf/ldconfig.c > index 2fc45ad8..e643dd57 100644 > --- a/elf/ldconfig.c > +++ b/elf/ldconfig.c
> - len = strlen (dir_name) + strlen (direntry->d_name) + 2; > - if (len > real_file_name_len) > - { > - real_file_name_len = len; > - real_file_name = alloca (real_file_name_len); > - } > - sprintf (real_file_name, "%s/%s", dir_name, direntry->d_name); > + if (asprintf (&real_file_name, "%s/%s", > + dir_name, direntry->d_name) < 0) > + error (EXIT_FAILURE, errno, _("Could not form library path")); > } > + else > + real_file_name = file_name; Maybe use xstrdup (file_name) here and free unconditionally below? It makes it easier to analyze the code for use-after-free errors. Rest looks okay. Reviewed-by: Florian Weimer <fwei...@redhat.com> Thanks, Florian