summaryrefslogtreecommitdiffstats
path: root/cmd-string.c
authornicm <nicm>2009-06-25 15:58:58 (GMT)
committer nicm <nicm>2009-06-25 15:58:58 (GMT)
commit3ab69f2c85b8e9f85d01c5fb3ca613e3be9ef51d (patch) (side-by-side diff)
tree70c7a724c4da25571c4ba9c19600589763cbc70a /cmd-string.c
parent1d4eb274382f4d551d105ce5c3c27a08747bab35 (diff)
downloadtmux-old-3ab69f2c85b8e9f85d01c5fb3ca613e3be9ef51d.zip
tmux-old-3ab69f2c85b8e9f85d01c5fb3ca613e3be9ef51d.tar.gz
tmux-old-3ab69f2c85b8e9f85d01c5fb3ca613e3be9ef51d.tar.bz2
strdup the input to putenv to avoid in one case passing a string that is later
freed and in the other const strings.
Diffstat (limited to 'cmd-string.c') (more/less context) (ignore whitespace changes)
-rw-r--r--cmd-string.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/cmd-string.c b/cmd-string.c
index 84ae2da..16f8f5a 100644
--- a/cmd-string.c
+++ b/cmd-string.c
@@ -1,4 +1,4 @@
-/* $Id$ */
+/* $OpenBSD: cmd-string.c,v 1.2 2009/06/05 07:18:37 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <[email protected]>
@@ -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);
}