From ee2a2242a009627fe6edd89f4624d8eb6dd1756c Mon Sep 17 00:00:00 2001 From: WangFengTu Date: Fri, 19 Aug 2022 14:32:22 +0800 Subject: [PATCH] return fail if no args or no rootfs path found Signed-off-by: WangFengTu --- src/lxc/lxccontainer.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c index 3f75184..2133782 100644 --- a/src/lxc/lxccontainer.c +++ b/src/lxc/lxccontainer.c @@ -1030,6 +1030,20 @@ static bool do_lxcapi_start(struct lxc_container *c, int useinit, char * const a argv = init_cmd = use_init_args(conf->init_argv, conf->init_argc); } + // do not allow using default rootfs path when isulad + if (conf->rootfs.mount == NULL || conf->rootfs.path == NULL) { + ERROR("Empty rootfs path detected"); + lxc_put_handler(handler); + return false; + } + + // do not allow using default args when isulad + if (!argv) { + ERROR("Empty args detected"); + lxc_put_handler(handler); + return false; + } + if (c->image_type_oci) { handler->image_type_oci = true; } -- 2.25.1