Skip to content

Commit aa1ada6

Browse files
authored
Merge pull request moby#41830 from ob/master
Fix an off-by-one bug
2 parents b5f863c + c923f6a commit aa1ada6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

daemon/graphdriver/overlay2/overlay.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -573,14 +573,14 @@ func (d *Driver) Get(id, mountLabel string) (_ containerfs.ContainerFS, retErr e
573573
// the page size. The mount syscall fails if the mount data cannot
574574
// fit within a page and relative links make the mount data much
575575
// smaller at the expense of requiring a fork exec to chroot.
576-
if len(mountData) > pageSize {
576+
if len(mountData) > pageSize-1 {
577577
if readonly {
578578
opts = indexOff + "lowerdir=" + path.Join(id, diffDirName) + ":" + string(lowers)
579579
} else {
580580
opts = indexOff + "lowerdir=" + string(lowers) + ",upperdir=" + path.Join(id, diffDirName) + ",workdir=" + path.Join(id, workDirName)
581581
}
582582
mountData = label.FormatMountLabel(opts, mountLabel)
583-
if len(mountData) > pageSize {
583+
if len(mountData) > pageSize-1 {
584584
return nil, fmt.Errorf("cannot mount layer, mount label too large %d", len(mountData))
585585
}
586586

0 commit comments

Comments
 (0)