Skip to content

Commit

Permalink
Merge pull request from GHSA-crp2-qrr5-8pq7
Browse files Browse the repository at this point in the history
Use fs.RootPath when mounting volumes
  • Loading branch information
dmcgowan authored Mar 2, 2022
2 parents 2cbf075 + d1d905b commit 5296045
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pkg/cri/opts/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"context"
"io/ioutil"
"os"
"path/filepath"

"github.com/containerd/containerd"
"github.com/containerd/containerd/containers"
Expand Down Expand Up @@ -89,7 +88,10 @@ func WithVolumes(volumeMounts map[string]string) containerd.NewContainerOpts {
}()

for host, volume := range volumeMounts {
src := filepath.Join(root, volume)
src, err := fs.RootPath(root, volume)
if err != nil {
return errors.Wrapf(err, "rootpath on root %s, volume %s", root, volume)
}
if _, err := os.Stat(src); err != nil {
if os.IsNotExist(err) {
// Skip copying directory if it does not exist.
Expand Down

0 comments on commit 5296045

Please sign in to comment.