mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-16 12:24:03 +00:00
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
This commit is contained in:
@ -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;
|
||||
|
Reference in New Issue
Block a user