[lxc-devel] [lxc/master] cgroups: please compilers
brauner on Github
lxc-bot at linuxcontainers.org
Fri Mar 27 23:27:51 UTC 2020
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 364 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200327/d537d246/attachment-0001.bin>
-------------- next part --------------
From 5045306b33be882e0df4f7d1b14987688a556cdb Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Sat, 28 Mar 2020 00:27:00 +0100
Subject: [PATCH] cgroups: please compilers
Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
src/lxc/cgroups/cgfsng.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/lxc/cgroups/cgfsng.c b/src/lxc/cgroups/cgfsng.c
index effbf11a87..b80d826f0d 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';
More information about the lxc-devel
mailing list