]> git.proxmox.com Git - mirror_lxc.git/commitdiff
cgroups: improve parameter vetting
authorChristian Brauner <christian.brauner@ubuntu.com>
Tue, 2 Feb 2021 23:00:50 +0000 (00:00 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Tue, 2 Feb 2021 23:00:50 +0000 (00:00 +0100)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/cgroups/cgfsng.c
src/lxc/lxccontainer.c

index 766ed3677b856916c70112bdcf333330daaccd65..0276411ab94c2d1527f8e8b0ef05d9e960960424 100644 (file)
@@ -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, '.');
index 63cf636288e2ea07ce27997a643fbabcf134231e..c8d93a30acbf946fb621c3821f2325074d47a732 100644 (file)
@@ -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;