From: srd424 Date: Sun, 3 Jul 2022 09:21:30 +0000 (+0100) Subject: Fix off-by-one error constructing mount options X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a86ad9c57b2de80bbd24793d6cf4f43021781b69;p=thirdparty%2Flxc.git Fix off-by-one error constructing mount options 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 (cherry picked from commit df3301046fc5f31881a2d4736cc5c381342ecc3d) --- diff --git a/src/lxc/storage/overlay.c b/src/lxc/storage/overlay.c index f8094fada..0c3fa1220 100644 --- a/src/lxc/storage/overlay.c +++ b/src/lxc/storage/overlay.c @@ -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,