aboutsummaryrefslogtreecommitdiff
path: root/tools/llvm-ld/llvm-ld.cpp
diff options
context:
space:
mode:
authorRoman Divacky <rdivacky@FreeBSD.org>2010-02-16 09:30:23 +0000
committerRoman Divacky <rdivacky@FreeBSD.org>2010-02-16 09:30:23 +0000
commit6fe5c7aa327e188b7176daa5595bbf075a6b94df (patch)
tree4cfca640904d1896e25032757a61f8959c066919 /tools/llvm-ld/llvm-ld.cpp
parent989df958a10f0beb90b89ccadd8351cbe51d90b1 (diff)
Notes
Diffstat (limited to 'tools/llvm-ld/llvm-ld.cpp')
-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 e71aefc0ce78..118f6b720c6e 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;