public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc/release/2.36/master] elf: Replace `strcpy` call with `memcpy` [BZ #29454]
@ 2022-08-11 15:32 Noah Goldstein
0 siblings, 0 replies; only message in thread
From: Noah Goldstein @ 2022-08-11 15:32 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=302bc33bc53c787da6e74162a7092e9c0fb964a8
commit 302bc33bc53c787da6e74162a7092e9c0fb964a8
Author: Noah Goldstein <goldstein.w.n@gmail.com>
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)
Diff:
---
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);
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-08-11 15:32 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-11 15:32 [glibc/release/2.36/master] elf: Replace `strcpy` call with `memcpy` [BZ #29454] Noah Goldstein
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).