From: Alexander Mikhalitsyn Date: Fri, 9 Dec 2022 18:22:56 +0000 (+0100) Subject: cgroups: fix buffer out-of-bounds access in enable_controllers_delegation X-Git-Tag: v6.0.0~77^2~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=93d545e37808631af08aa4d6b0325d3352cf89b5;p=thirdparty%2Flxc.git cgroups: fix buffer out-of-bounds access in enable_controllers_delegation Reported-by: coverity (CID #1517317) Signed-off-by: Alexander Mikhalitsyn --- diff --git a/src/lxc/cgroups/cgfsng.c b/src/lxc/cgroups/cgfsng.c index dc4caa2b4..8a3693d29 100644 --- a/src/lxc/cgroups/cgfsng.c +++ b/src/lxc/cgroups/cgfsng.c @@ -1162,7 +1162,7 @@ static bool enable_controllers_delegation(int fd_dir, char *cg) lxc_iterate_parts(controller, rbuf, " ") { full_len += strlen(controller) + 2; - wbuf = must_realloc(wbuf, full_len); + wbuf = must_realloc(wbuf, full_len + 1); if (first) { wbuf[0] = '\0'; first = false;