summaryrefslogtreecommitdiff
path: root/os/utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'os/utils.c')
-rw-r--r--os/utils.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/os/utils.c b/os/utils.c
index 07cf4c24f..1c75dfce4 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -1664,13 +1664,11 @@ CheckUserParameters(int argc, char **argv, char **envp)
if (!eq)
continue;
len = eq - envp[i];
- e = malloc(len + 1);
+ e = strndup(envp[i], len);
if (!e) {
bad = InternalError;
break;
}
- strncpy(e, envp[i], len);
- e[len] = 0;
if (len >= 4 &&
(strcmp(e + len - 4, "PATH") == 0 ||
strcmp(e, "TERMCAP") == 0)) {