From b57f9b131918c064b43cc371f3123492355b5c16 Mon Sep 17 00:00:00 2001 From: Christian Brauner Date: Tue, 2 Feb 2021 21:59:04 +0100 Subject: [PATCH] cgroups: vet parameters Signed-off-by: Christian Brauner --- src/lxc/cgroups/cgfsng.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/lxc/cgroups/cgfsng.c b/src/lxc/cgroups/cgfsng.c index 638e2f3c1..677b70cc6 100644 --- a/src/lxc/cgroups/cgfsng.c +++ b/src/lxc/cgroups/cgfsng.c @@ -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); -- 2.47.2