]> git.proxmox.com Git - mirror_lxc.git/commitdiff
cgroups: fix buffer out-of-bounds access in enable_controllers_delegation
authorAlexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
Fri, 9 Dec 2022 18:22:56 +0000 (19:22 +0100)
committerAlexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
Mon, 12 Dec 2022 09:35:02 +0000 (10:35 +0100)
Reported-by: coverity (CID #1517317)
Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
src/lxc/cgroups/cgfsng.c

index dc4caa2b4d407bf2881fa53ed10daf96a2741743..8a3693d29ed69488f065b5ec1f75dfee0721b516 100644 (file)
@@ -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;