mirror of
https://github.com/tmux/tmux.git
synced 2024-11-16 01:18:52 +00:00
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
This commit is contained in:
parent
1156467726
commit
a3c32841e6
@ -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)
|
if ((t = strchr(s, ' ')) == NULL && (t = strchr(s, '\t')) == NULL)
|
||||||
t = strchr(s, '\0');
|
t = strchr(s, '\0');
|
||||||
if ((u = strchr(s, '=')) != NULL && u < t) {
|
if ((u = strchr(s, '=')) != NULL && u < t) {
|
||||||
if (putenv((char *) s) != 0) {
|
if (putenv(xstrdup(s)) != 0) {
|
||||||
xasprintf(cause, "assignment failed: %s", s);
|
xasprintf(cause, "assignment failed: %s", s);
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
2
window.c
2
window.c
@ -473,7 +473,7 @@ window_pane_spawn(struct window_pane *wp,
|
|||||||
if (chdir(wp->cwd) != 0)
|
if (chdir(wp->cwd) != 0)
|
||||||
chdir("/");
|
chdir("/");
|
||||||
for (envq = envp; *envq != NULL; envq++) {
|
for (envq = envp; *envq != NULL; envq++) {
|
||||||
if (putenv((char *) *envq) != 0)
|
if (putenv(xstrdup(*envq)) != 0)
|
||||||
fatal("putenv failed");
|
fatal("putenv failed");
|
||||||
}
|
}
|
||||||
sigreset();
|
sigreset();
|
||||||
|
Loading…
Reference in New Issue
Block a user