소스 검색

Merge pull request #41830 from ob/master

Fix an off-by-one bug
Akihiro Suda 4 년 전
부모
커밋
aa1ada6b2a
1개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  1. 2 2
      daemon/graphdriver/overlay2/overlay.go

+ 2 - 2
daemon/graphdriver/overlay2/overlay.go

@@ -573,14 +573,14 @@ func (d *Driver) Get(id, mountLabel string) (_ containerfs.ContainerFS, retErr e
 	// the page size. The mount syscall fails if the mount data cannot
 	// fit within a page and relative links make the mount data much
 	// smaller at the expense of requiring a fork exec to chroot.
-	if len(mountData) > pageSize {
+	if len(mountData) > pageSize-1 {
 		if readonly {
 			opts = indexOff + "lowerdir=" + path.Join(id, diffDirName) + ":" + string(lowers)
 		} else {
 			opts = indexOff + "lowerdir=" + string(lowers) + ",upperdir=" + path.Join(id, diffDirName) + ",workdir=" + path.Join(id, workDirName)
 		}
 		mountData = label.FormatMountLabel(opts, mountLabel)
-		if len(mountData) > pageSize {
+		if len(mountData) > pageSize-1 {
 			return nil, fmt.Errorf("cannot mount layer, mount label too large %d", len(mountData))
 		}