public inbox for
help / color / mirror / Atom feed
From: Szabolcs Nagy <>
Subject: [glibc/arm/morello/main] elf: Replace `strcpy` call with `memcpy` [BZ #29454]
Date: Wed, 26 Oct 2022 15:04:42 +0000 (GMT)	[thread overview]
Message-ID: <> (raw);h=302bc33bc53c787da6e74162a7092e9c0fb964a8

commit 302bc33bc53c787da6e74162a7092e9c0fb964a8
Author: Noah Goldstein <>
Date:   Mon Aug 8 11:26:22 2022 +0800

    elf: Replace `strcpy` call with `memcpy` [BZ #29454]
    GCC normally does this optimization for us in
    strlen_pass::handle_builtin_strcpy but only for optimized
    build. To avoid needing to include strcpy.S in the rtld build to
    support the debug build, just do the optimization by hand.
    (cherry picked from commit 483cfe1a6a33d6335b1901581b41040d2d412511)

 elf/dl-cache.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/elf/dl-cache.c b/elf/dl-cache.c
index 8bbf110d02..b97c17b3a9 100644
--- a/elf/dl-cache.c
+++ b/elf/dl-cache.c
@@ -509,8 +509,9 @@ _dl_load_cache_lookup (const char *name)
      we are accessing. Therefore we must make the copy of the
      mapping data without using malloc.  */
   char *temp;
-  temp = alloca (strlen (best) + 1);
-  strcpy (temp, best);
+  size_t best_len = strlen (best) + 1;
+  temp = alloca (best_len);
+  memcpy (temp, best, best_len);
   return __strdup (temp);

                 reply	other threads:[~2022-10-26 15:04 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \

* 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).