From: Christian Brauner Date: Fri, 27 Mar 2020 23:27:00 +0000 (+0100) Subject: cgroups: please compilers X-Git-Tag: lxc-5.0.0~485^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F3336%2Fhead;p=thirdparty%2Flxc.git cgroups: please compilers Signed-off-by: Christian Brauner --- diff --git a/src/lxc/cgroups/cgfsng.c b/src/lxc/cgroups/cgfsng.c index effbf11a8..b80d826f0 100644 --- a/src/lxc/cgroups/cgfsng.c +++ b/src/lxc/cgroups/cgfsng.c @@ -2085,8 +2085,10 @@ static int cgroup_attach_leaf(const struct lxc_conf *conf, int unified_fd, pid_t char attach_cgroup[STRLITERALLEN(".lxc-1000/cgroup.procs") + 1]; char *slash; - snprintf(attach_cgroup, STRLITERALLEN(".lxc-%d/cgroup.procs"), - ".lxc-%d/cgroup.procs", idx); + ret = snprintf(attach_cgroup, sizeof(attach_cgroup), ".lxc-%d/cgroup.procs", idx); + if (ret < 0 || (size_t)ret >= sizeof(attach_cgroup)) + return ret_errno(EIO); + slash = &attach_cgroup[ret] - STRLITERALLEN("/cgroup.procs"); *slash = '\0';