From: Florian Weimer <fweimer@redhat.com>
To: Sergey Bugaev via Libc-alpha <libc-alpha@sourceware.org>
Cc: bug-hurd@gnu.org, Sergey Bugaev <bugaevc@gmail.com>
Subject: Re: [RFC PATCH 1/2] elf: Port ldconfig away from stack-allocated paths
Date: Fri, 19 May 2023 14:25:52 +0200 [thread overview]
Message-ID: <87jzx4jynj.fsf@oldenburg3.str.redhat.com> (raw)
In-Reply-To: <20230517185422.71084-2-bugaevc@gmail.com> (Sergey Bugaev via Libc-alpha's message of "Wed, 17 May 2023 21:54:21 +0300")
* Sergey Bugaev via Libc-alpha:
> @@ -733,25 +723,11 @@ search_dir (const struct dir_entry *entry)
> + 1, ".#prelink#.", sizeof (".#prelink#.") - 1) == 0)
> continue;
> }
> - len += strlen (entry->path) + 2;
> - if (len > file_name_len)
> - {
> - file_name_len = len;
> - file_name = alloca (file_name_len);
> - if (!opt_chroot)
> - real_file_name = file_name;
> - }
> - sprintf (file_name, "%s/%s", entry->path, direntry->d_name);
> + asprintf (&file_name, "%s/%s", entry->path, direntry->d_name);
> if (opt_chroot != NULL)
> - {
> - 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);
> - }
> + asprintf (&real_file_name, "%s/%s", dir_name, direntry->d_name);
> + else
> + real_file_name = file_name;
>
> struct stat lstat_buf;
> /* We optimize and try to do the lstat call only if needed. */
Missing error checking?
I think we use x* functions such a xstrdup elsewhere in ldconfig, so you
could add xasprintf as well.
Thanks,
Florian
next prev parent reply other threads:[~2023-05-19 12:25 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-17 18:54 [RFC PATCH 0/2] On ldconfig and ld.so.cache Sergey Bugaev
2023-05-17 18:54 ` [RFC PATCH 1/2] elf: Port ldconfig away from stack-allocated paths Sergey Bugaev
2023-05-18 19:13 ` Adhemerval Zanella Netto
2023-05-19 12:25 ` Florian Weimer [this message]
2023-05-20 19:03 ` Sergey Bugaev
2023-05-23 17:57 ` Adhemerval Zanella Netto
2023-05-25 8:07 ` Florian Weimer
2023-05-17 18:54 ` [RFC PATCH 2/2] x86: Make dl-cache.h and readelflib.c not Linux-specific Sergey Bugaev
2023-05-19 11:36 ` Carlos O'Donell
2023-05-19 11:52 ` [RFC PATCH 0/2] On ldconfig and ld.so.cache Carlos O'Donell
2023-05-19 12:30 ` Florian Weimer
2023-05-19 13:21 ` Sergey Bugaev
2023-05-24 14:09 ` Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87jzx4jynj.fsf@oldenburg3.str.redhat.com \
--to=fweimer@redhat.com \
--cc=bug-hurd@gnu.org \
--cc=bugaevc@gmail.com \
--cc=libc-alpha@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).