[lxc-devel] [lxc/master] Fix null derefence if attach is called without access to any tty

cwoac on Github lxc-bot at linuxcontainers.org
Sun Sep 25 08:55:29 UTC 2016


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 567 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20160925/1128a1e2/attachment.bin>
-------------- next part --------------
From b9a24c4f2f60aeb754a0dc5755f59b8acdb0af3a Mon Sep 17 00:00:00 2001
From: Oliver Matthews <oliver at codersoffortune.net>
Date: Sun, 25 Sep 2016 09:37:43 +0100
Subject: [PATCH] Fix null derefence if attach is called without access to any
 tty

Signed-off-by: Oliver Matthews <oliver at codersoffortune.net>
---
 src/lxc/tools/lxc_attach.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/lxc/tools/lxc_attach.c b/src/lxc/tools/lxc_attach.c
index 9d71388..23d63a2 100644
--- a/src/lxc/tools/lxc_attach.c
+++ b/src/lxc/tools/lxc_attach.c
@@ -321,7 +321,7 @@ static int get_pty_on_host(struct lxc_container *c, struct wrapargs *wrap, int *
 err3:
 	lxc_mainloop_close(&descr);
 err2:
-	if (ts->sigfd != -1)
+	if (ts && ts->sigfd != -1)
 		lxc_console_sigwinch_fini(ts);
 err1:
 	lxc_console_delete(&conf->console);


More information about the lxc-devel mailing list