From: Christian Brauner Date: Tue, 2 Feb 2021 23:00:50 +0000 (+0100) Subject: cgroups: improve parameter vetting X-Git-Tag: lxc-5.0.0~305^2 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=b7aeda9691f782e1d13b6ab57bd6c27d5dc4cc87;p=mirror_lxc.git cgroups: improve parameter vetting Signed-off-by: Christian Brauner --- diff --git a/src/lxc/cgroups/cgfsng.c b/src/lxc/cgroups/cgfsng.c index 766ed3677..0276411ab 100644 --- a/src/lxc/cgroups/cgfsng.c +++ b/src/lxc/cgroups/cgfsng.c @@ -2622,8 +2622,9 @@ __cgfsng_ops static int cgfsng_set(struct cgroup_ops *ops, struct hierarchy *h; int ret = -1; - if (!ops || !key || !value || !name || !lxcpath) - return ret_errno(ENOENT); + if (!ops || is_empty_string(key) || is_empty_string(value) || + is_empty_string(name) || is_empty_string(lxcpath)) + return ret_errno(EINVAL); controller = must_copy_string(key); p = strchr(controller, '.'); diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c index 63cf63628..c8d93a30a 100644 --- a/src/lxc/lxccontainer.c +++ b/src/lxc/lxccontainer.c @@ -3300,7 +3300,7 @@ static bool do_lxcapi_set_cgroup_item(struct lxc_container *c, const char *subsy if (!cgroup_ops) return false; - ret = cgroup_ops->set(cgroup_ops, subsys, value, c->name, c->config_path) == 0; + ret = cgroup_ops->set(cgroup_ops, subsys, value, c->name, c->config_path); } return ret == 0;