Unverified Commit a836df04 by Scott Parlane Committed by Christian Brauner

avoid a NULL pointer dereference in lxc-attach

Seems to appear when stderr is a terminal and not stdin or stdout. Signed-off-by: 's avatarScott Parlane <scott.parlane@alliedtelesis.co.nz>
parent 8c23afc3
...@@ -1384,6 +1384,8 @@ int lxc_attach(struct lxc_container *container, lxc_attach_exec_t exec_function, ...@@ -1384,6 +1384,8 @@ int lxc_attach(struct lxc_container *container, lxc_attach_exec_t exec_function,
if (pid == 0) { if (pid == 0) {
if (options->attach_flags & LXC_ATTACH_TERMINAL) { if (options->attach_flags & LXC_ATTACH_TERMINAL) {
if (terminal.tty_state)
{
ret = pthread_sigmask(SIG_SETMASK, ret = pthread_sigmask(SIG_SETMASK,
&terminal.tty_state->oldmask, NULL); &terminal.tty_state->oldmask, NULL);
if (ret < 0) { if (ret < 0) {
...@@ -1391,6 +1393,7 @@ int lxc_attach(struct lxc_container *container, lxc_attach_exec_t exec_function, ...@@ -1391,6 +1393,7 @@ int lxc_attach(struct lxc_container *container, lxc_attach_exec_t exec_function,
_exit(EXIT_FAILURE); _exit(EXIT_FAILURE);
} }
} }
}
ret = attach_child_main(&payload); ret = attach_child_main(&payload);
if (ret < 0) if (ret < 0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment