Skip to content

Commit

Permalink
Fix off-by-one error constructing mount options
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
srd424 committed Jul 3, 2022
1 parent cf1f3bc commit df33010
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/lxc/storage/overlay.c
Expand Up @@ -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,
Expand Down

0 comments on commit df33010

Please sign in to comment.