mirror of
https://github.com/tmux/tmux.git
synced 2025-04-04 23:28:51 +00:00
Fix read of uninitialized memory for jobs with JOB_PTY flag. From David
Mandelberg.
This commit is contained in:
parent
483b2b3edb
commit
ef0c12ad9e
5
job.c
5
job.c
@ -183,7 +183,7 @@ job_run(const char *cmd, int argc, char **argv, struct environ *e,
|
|||||||
environ_free(env);
|
environ_free(env);
|
||||||
free(argv0);
|
free(argv0);
|
||||||
|
|
||||||
job = xmalloc(sizeof *job);
|
job = xcalloc(1, sizeof *job);
|
||||||
job->state = JOB_RUNNING;
|
job->state = JOB_RUNNING;
|
||||||
job->flags = flags;
|
job->flags = flags;
|
||||||
|
|
||||||
@ -192,7 +192,8 @@ job_run(const char *cmd, int argc, char **argv, struct environ *e,
|
|||||||
else
|
else
|
||||||
job->cmd = cmd_stringify_argv(argc, argv);
|
job->cmd = cmd_stringify_argv(argc, argv);
|
||||||
job->pid = pid;
|
job->pid = pid;
|
||||||
strlcpy(job->tty, tty, sizeof job->tty);
|
if (flags & JOB_PTY)
|
||||||
|
strlcpy(job->tty, tty, sizeof job->tty);
|
||||||
job->status = 0;
|
job->status = 0;
|
||||||
|
|
||||||
LIST_INSERT_HEAD(&all_jobs, job, entry);
|
LIST_INSERT_HEAD(&all_jobs, job, entry);
|
||||||
|
Loading…
Reference in New Issue
Block a user