diff options
author | Nicholas Marriott <nicm@openbsd.org> | 2009-06-05 07:18:37 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@openbsd.org> | 2009-06-05 07:18:37 +0000 |
commit | a3c32841e631590d26884731acd8f44a32516054 (patch) | |
tree | 21d98a4c3c0277a37e1daba692c1fea805d6f6b8 /cmd-string.c | |
parent | 1156467726a21f2126e0b382223118298c623b22 (diff) |
strdup the input to putenv to avoid in one case passing a string that is later
freed and in the other const strings.
looks sane to millert, ok ray
Diffstat (limited to 'cmd-string.c')
-rw-r--r-- | cmd-string.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/cmd-string.c b/cmd-string.c index 1e471081..a5c5dd12 100644 --- a/cmd-string.c +++ b/cmd-string.c @@ -63,7 +63,7 @@ cmd_string_parse(const char *s, struct cmd_list **cmdlist, char **cause) if ((t = strchr(s, ' ')) == NULL && (t = strchr(s, '\t')) == NULL) t = strchr(s, '\0'); if ((u = strchr(s, '=')) != NULL && u < t) { - if (putenv((char *) s) != 0) { + if (putenv(xstrdup(s)) != 0) { xasprintf(cause, "assignment failed: %s", s); return (-1); } |