summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-ld/llvm-ld.cpp
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
commit29063eac2309c996aa8d23a0abf596c524d6cb89 (patch)
tree530aaea0eb2802c7d68ee707dd3458c3ef631f8d /llvm/tools/llvm-ld/llvm-ld.cpp
parent3a48b87c54b2eda1aa0798e87ffea735f28d5e8b (diff)
downloadbcm5719-llvm-29063eac2309c996aa8d23a0abf596c524d6cb89.tar.gz
bcm5719-llvm-29063eac2309c996aa8d23a0abf596c524d6cb89.zip
Replace strcpy with memcpy when we have the length around anyway.
llvm-svn: 94746
Diffstat (limited to 'llvm/tools/llvm-ld/llvm-ld.cpp')
-rw-r--r--llvm/tools/llvm-ld/llvm-ld.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/tools/llvm-ld/llvm-ld.cpp b/llvm/tools/llvm-ld/llvm-ld.cpp
index e71aefc0ce7..118f6b720c6 100644
--- a/llvm/tools/llvm-ld/llvm-ld.cpp
+++ b/llvm/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;
OpenPOWER on IntegriCloud