diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2011-10-24 23:16:30 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2011-11-23 12:15:05 -0800 |
commit | 08093c25a91c07ab8af7cece9bba738b827cfd1b (patch) | |
tree | 782fcb6921d2e432de5b9ba886b539f08c8ff596 /os | |
parent | acde97a39d35bfb03af2614c68176ad9afb71f53 (diff) |
Convert some malloc + strncpy pairs into strndup calls
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Diffstat (limited to 'os')
-rw-r--r-- | os/utils.c | 4 |
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)) { |