]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
cgroups: vet parameters
authorChristian Brauner <christian.brauner@ubuntu.com>
Tue, 2 Feb 2021 20:59:04 +0000 (21:59 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Tue, 2 Feb 2021 20:59:04 +0000 (21:59 +0100)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/cgroups/cgfsng.c

index 638e2f3c152440bca70c63db857701075ad093ea..677b70cc6b4235230b198b87aae815e7008bca71 100644 (file)
@@ -3597,6 +3597,9 @@ bool cgroup_freeze(const char *name, const char *lxcpath, int timeout)
        __do_close int unified_fd = -EBADF;
        int ret;
 
+       if (is_empty_string(name) || is_empty_string(lxcpath))
+               return ret_errno(EINVAL);
+
        unified_fd = lxc_cmd_get_cgroup2_fd(name, lxcpath);
        if (unified_fd < 0)
                return ret_errno(ENOCGROUP2);
@@ -3614,6 +3617,9 @@ bool cgroup_unfreeze(const char *name, const char *lxcpath, int timeout)
        __do_close int unified_fd = -EBADF;
        int ret;
 
+       if (is_empty_string(name) || is_empty_string(lxcpath))
+               return ret_errno(EINVAL);
+
        unified_fd = lxc_cmd_get_cgroup2_fd(name, lxcpath);
        if (unified_fd < 0)
                return ret_errno(ENOCGROUP2);