The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxc/pull/3532
This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) === Seems to appear when stderr is a terminal and not stdin or stdout. Signed-off-by: Scott Parlane <scott.parl...@alliedtelesis.co.nz>
From d9346e19eb953c9f71d545019fc260da046e910f Mon Sep 17 00:00:00 2001 From: Scott Parlane <scott.parl...@alliedtelesis.co.nz> Date: Wed, 2 Sep 2020 17:01:11 +1200 Subject: [PATCH] avoid a NULL pointer dereference in lxc-attach Seems to appear when stderr is a terminal and not stdin or stdout. Signed-off-by: Scott Parlane <scott.parl...@alliedtelesis.co.nz> --- src/lxc/attach.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/lxc/attach.c b/src/lxc/attach.c index 4b95989227..368dd41ad1 100644 --- a/src/lxc/attach.c +++ b/src/lxc/attach.c @@ -1384,11 +1384,14 @@ int lxc_attach(struct lxc_container *container, lxc_attach_exec_t exec_function, if (pid == 0) { if (options->attach_flags & LXC_ATTACH_TERMINAL) { - ret = pthread_sigmask(SIG_SETMASK, - &terminal.tty_state->oldmask, NULL); - if (ret < 0) { - SYSERROR("Failed to reset signal mask"); - _exit(EXIT_FAILURE); + if (terminal.tty_state) + { + ret = pthread_sigmask(SIG_SETMASK, + &terminal.tty_state->oldmask, NULL); + if (ret < 0) { + SYSERROR("Failed to reset signal mask"); + _exit(EXIT_FAILURE); + } } }
_______________________________________________ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel