summaryrefslogtreecommitdiff
path: root/tools/llvm-ld
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2010-01-28 18:04:38 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2010-01-28 18:04:38 +0000
commit12ea66a7277240c5b045ed14c140f94d453eea0e (patch)
tree86b0fb053e20cd76aab065b69b25eee033939677 /tools/llvm-ld
parent2c47368a7d843486a59e12a08595297003e3cb2d (diff)
downloadllvm-12ea66a7277240c5b045ed14c140f94d453eea0e.tar.gz
llvm-12ea66a7277240c5b045ed14c140f94d453eea0e.tar.bz2
llvm-12ea66a7277240c5b045ed14c140f94d453eea0e.tar.xz
Replace strcpy with memcpy when we have the length around anyway.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94746 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-ld')
-rw-r--r--tools/llvm-ld/llvm-ld.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/llvm-ld/llvm-ld.cpp b/tools/llvm-ld/llvm-ld.cpp
index e71aefc0ce..118f6b720c 100644
--- a/tools/llvm-ld/llvm-ld.cpp
+++ b/tools/llvm-ld/llvm-ld.cpp
@@ -179,8 +179,9 @@ static char ** CopyEnv(char ** const envp) {
// Make a copy of the list. Don't forget the NULL that ends the list.
entries = 0;
while (envp[entries] != NULL) {
- newenv[entries] = new char[strlen (envp[entries]) + 1];
- strcpy (newenv[entries], envp[entries]);
+ size_t len = strlen(envp[entries]) + 1;
+ newenv[entries] = new char[len];
+ memcpy(newenv[entries], envp[entries], len);
++entries;
}
newenv[entries] = NULL;