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>
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,