From 2fe301c4bdbe6acbdc756e010cd27bbdcf45efe0 Mon Sep 17 00:00:00 2001 From: Slava Bacherikov Date: Thu, 6 May 2021 00:43:02 +0300 Subject: [PATCH] Fix infinite loop in isPathOnVolume filepath.Dir in some cases returns `.` symbol and calling this function again returns same result. In such cases this function never returns and causes some operations to stuck forever. Closes #10216 --- libpod/container_path_resolution.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libpod/container_path_resolution.go b/libpod/container_path_resolution.go index d798963b16c8..ec7306ca1db6 100644 --- a/libpod/container_path_resolution.go +++ b/libpod/container_path_resolution.go @@ -128,7 +128,7 @@ func isPathOnVolume(c *Container, containerPath string) bool { if cleanedContainerPath == filepath.Clean(vol.Dest) { return true } - for dest := vol.Dest; dest != "/"; dest = filepath.Dir(dest) { + for dest := vol.Dest; dest != "/" && dest != "."; dest = filepath.Dir(dest) { if cleanedContainerPath == dest { return true }