浏览代码

Update daemon_linux.go for preventing off-by-one

Array length should be bigger than 5, when accessing index 4

Signed-off-by: J-jaeyoung <jjy600901@gmail.com>
정재영 4 年之前
父节点
当前提交
19eda6b9a2
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      daemon/daemon_linux.go

+ 1 - 1
daemon/daemon_linux.go

@@ -44,7 +44,7 @@ func (daemon *Daemon) cleanupMountsFromReaderByID(reader io.Reader, id string, u
 	regexps := getCleanPatterns(id)
 	sc := bufio.NewScanner(reader)
 	for sc.Scan() {
-		if fields := strings.Fields(sc.Text()); len(fields) >= 4 {
+		if fields := strings.Fields(sc.Text()); len(fields) > 4 {
 			if mnt := fields[4]; strings.HasPrefix(mnt, daemon.root) {
 				for _, p := range regexps {
 					if p.MatchString(mnt) {