[lxc-devel] [lxc/master] lxccontainer: fix dereferenced pointer

2xsec on Github lxc-bot at linuxcontainers.org
Thu Sep 6 05:39:30 UTC 2018


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 409 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20180906/0686611f/attachment.bin>
-------------- next part --------------
From 8819940a53cff97e16df34a8af28afaea50f4939 Mon Sep 17 00:00:00 2001
From: 2xsec <dh48.jeong at samsung.com>
Date: Thu, 6 Sep 2018 14:38:20 +0900
Subject: [PATCH] lxccontainer: fix dereferenced pointer

Signed-off-by: 2xsec <dh48.jeong at samsung.com>
---
 src/lxc/lxccontainer.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c
index cdd164202..000d26055 100644
--- a/src/lxc/lxccontainer.c
+++ b/src/lxc/lxccontainer.c
@@ -583,6 +583,9 @@ static int do_lxcapi_console_log(struct lxc_container *c, struct lxc_console_log
 {
 	int ret;
 
+	if (!c)
+		return -1;
+
 	ret = lxc_cmd_console_log(c->name, do_lxcapi_get_config_path(c), log);
 	if (ret < 0) {
 		if (ret == -ENODATA)
@@ -4548,6 +4551,9 @@ WRAP_API(bool, lxcapi_snapshot_destroy_all)
 
 static bool do_lxcapi_may_control(struct lxc_container *c)
 {
+	if (!c)
+		return false;
+
 	return lxc_try_cmd(c->name, c->config_path) == 0;
 }
 


More information about the lxc-devel mailing list