mirror of
https://github.com/tmate-io/tmate.git
synced 2025-08-15 08:12:46 +02:00
strdup the input to putenv to avoid in one case passing a string that is later
freed and in the other const strings.
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
/* $Id: cmd-string.c,v 1.15 2009-05-15 12:58:56 nicm Exp $ */
|
||||
/* $OpenBSD: cmd-string.c,v 1.2 2009/06/05 07:18:37 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user