mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-02-04 14:12:24 +00:00
Patch from Colin Watson: we were sometimes passing stack storage to putenv(),
which is Bad (in his case, it caused TERM to end up unset). Use malloc()'d storage instead. [originally from svn r6095]
This commit is contained in:
parent
eec73ea3b6
commit
36ff0a38f4
12
unix/uxpty.c
12
unix/uxpty.c
@ -754,15 +754,19 @@ static const char *pty_init(void *frontend, void **backend_handle, Config *cfg,
|
|||||||
for (i = 3; i < 1024; i++)
|
for (i = 3; i < 1024; i++)
|
||||||
close(i);
|
close(i);
|
||||||
{
|
{
|
||||||
char term_env_var[10 + sizeof(cfg->termtype)];
|
char *term_env_var = dupprintf("TERM=%s", cfg->termtype);
|
||||||
sprintf(term_env_var, "TERM=%s", cfg->termtype);
|
|
||||||
putenv(term_env_var);
|
putenv(term_env_var);
|
||||||
|
/* We mustn't free term_env_var, as putenv links it into the
|
||||||
|
* environment in place.
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
#ifndef NOT_X_WINDOWS /* for Mac OS X native compilation */
|
#ifndef NOT_X_WINDOWS /* for Mac OS X native compilation */
|
||||||
{
|
{
|
||||||
char windowid_env_var[40];
|
char *windowid_env_var = dupprintf("WINDOWID=%ld", windowid);
|
||||||
sprintf(windowid_env_var, "WINDOWID=%ld", windowid);
|
|
||||||
putenv(windowid_env_var);
|
putenv(windowid_env_var);
|
||||||
|
/* We mustn't free windowid_env_var, as putenv links it into the
|
||||||
|
* environment in place.
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user