os/env: fix pvs/v781

This commit is contained in:
Jan Edmund Lazo
2019-12-25 19:39:44 -05:00
parent d6ba578ccb
commit 234c4a846b

View File

@@ -266,10 +266,8 @@ void os_copy_fullenv(char **env, size_t env_size)
extern char **environ;
# endif
size_t i = 0;
while (environ[i] != NULL && i < env_size) {
for (size_t i = 0; i < env_size && environ[i] != NULL; i++) {
env[i] = xstrdup(environ[i]);
i++;
}
#endif
}