diff options
| author | Roman Divacky <rdivacky@FreeBSD.org> | 2010-02-16 09:30:23 +0000 |
|---|---|---|
| committer | Roman Divacky <rdivacky@FreeBSD.org> | 2010-02-16 09:30:23 +0000 |
| commit | 6fe5c7aa327e188b7176daa5595bbf075a6b94df (patch) | |
| tree | 4cfca640904d1896e25032757a61f8959c066919 /tools/llvm-ld/llvm-ld.cpp | |
| parent | 989df958a10f0beb90b89ccadd8351cbe51d90b1 (diff) | |
Notes
Diffstat (limited to 'tools/llvm-ld/llvm-ld.cpp')
| -rw-r--r-- | tools/llvm-ld/llvm-ld.cpp | 5 |
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; |
