]> git.proxmox.com Git - mirror_lxc.git/commitdiff
Fix off-by-one error constructing mount options
authorsrd424 <srd424@users.noreply.github.com>
Sun, 3 Jul 2022 09:21:30 +0000 (10:21 +0100)
committerGitHub <noreply@github.com>
Sun, 3 Jul 2022 09:21:30 +0000 (10:21 +0100)
This fixes a really subtle off-by-one error constructing overlay mount options if rootfs options are provided and modern overlayfs (i.e. requiring a workdir) is used. We need to allow for the extra "," required to separate the extra options when computing the length!

Signed-off-by: srd424 <srd424@users.noreply.github.com>
src/lxc/storage/overlay.c

index f8094fadabab769f173d29ac50fe9b910d1cfa46..0c3fa122019498ec10b289725f4a1c9e94f382eb 100644 (file)
@@ -445,7 +445,7 @@ int ovl_mount(struct lxc_storage *bdev)
                               upper, lower, mntdata);
 
                len2 = strlen(lower) + strlen(upper) + strlen(work) +
-                      strlen("upperdir=,lowerdir=,workdir=") +
+                      strlen("upperdir=,lowerdir=,workdir=,") +
                       strlen(mntdata) + 1;
                options_work = must_realloc(NULL, len2);
                ret2 = snprintf(options, len2,