Browse Source

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 years ago
parent
commit
19eda6b9a2
1 changed files with 1 additions and 1 deletions
  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) {