Skip to content

Commit

Permalink
Fix infinite loop in isPathOnVolume
Browse files Browse the repository at this point in the history
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 containers#10216

Signed-off-by: Slava Bacherikov <slava@bacher09.org>
  • Loading branch information
bacher09 committed May 5, 2021
1 parent ed6f399 commit 25921b7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libpod/container_path_resolution.go
Expand Up @@ -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
}
Expand Down

0 comments on commit 25921b7

Please sign in to comment.