mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-26 10:51:54 -04:00
Replace VLA envp_dynamic with malloc in fork child exec path
This commit is contained in:
parent
6c85573d12
commit
acdf29ac09
1 changed files with 4 additions and 2 deletions
|
|
@ -859,10 +859,12 @@ int os_script(char** argv, char** envp, const char* run_as_user)
|
|||
if (envp != NULL) {
|
||||
int envv_count = 0;
|
||||
while (envp[envv_count] != NULL) {
|
||||
envv_count++;
|
||||
++envv_count;
|
||||
}
|
||||
int scrubbed_count = sizeof(envp_scrubbed) / sizeof(envp_scrubbed[0]) - 1;
|
||||
char* envp_dynamic[scrubbed_count + envv_count + 1];
|
||||
char** envp_dynamic = malloc((size_t)(scrubbed_count + envv_count + 1) * sizeof(char*));
|
||||
if (!envp_dynamic)
|
||||
_exit(126);
|
||||
for (int i = 0; i < scrubbed_count; ++i) {
|
||||
envp_dynamic[i] = envp_scrubbed[i];
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue