[PATCH] Use fs.RootPath when mounting volumes
Signed-off-by: Ruiwen Zhao <ruiwen@google.com> Gbp-Pq: Name CVE-2022-23648.patch
This commit is contained in:
parent
4cde249d7b
commit
3b34805efb
|
@ -20,7 +20,6 @@ import (
|
|||
"context"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/containerd/containerd"
|
||||
"github.com/containerd/containerd/containers"
|
||||
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue