diff options
author | dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> | 2021-07-05 12:20:31 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-05 12:20:31 +0000 |
commit | 518457b3546e87bd7a8fe9f9a917b8b9c7bcaad6 (patch) | |
tree | c85706331290d8d57afe0ca34df58736802c23db /vendor/github.com/cyphar/filepath-securejoin/join.go | |
parent | 2681484d7cc416eea6773469884451800c0a07d4 (diff) | |
download | podman-518457b3546e87bd7a8fe9f9a917b8b9c7bcaad6.tar.gz podman-518457b3546e87bd7a8fe9f9a917b8b9c7bcaad6.tar.bz2 podman-518457b3546e87bd7a8fe9f9a917b8b9c7bcaad6.zip |
Bump github.com/cyphar/filepath-securejoin from 0.2.2 to 0.2.3
Bumps [github.com/cyphar/filepath-securejoin](https://github.com/cyphar/filepath-securejoin) from 0.2.2 to 0.2.3.
- [Release notes](https://github.com/cyphar/filepath-securejoin/releases)
- [Commits](https://github.com/cyphar/filepath-securejoin/compare/v0.2.2...v0.2.3)
---
updated-dependencies:
- dependency-name: github.com/cyphar/filepath-securejoin
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Diffstat (limited to 'vendor/github.com/cyphar/filepath-securejoin/join.go')
-rw-r--r-- | vendor/github.com/cyphar/filepath-securejoin/join.go | 25 |
1 files changed, 3 insertions, 22 deletions
diff --git a/vendor/github.com/cyphar/filepath-securejoin/join.go b/vendor/github.com/cyphar/filepath-securejoin/join.go index c4ca3d713..7dd08dbbd 100644 --- a/vendor/github.com/cyphar/filepath-securejoin/join.go +++ b/vendor/github.com/cyphar/filepath-securejoin/join.go @@ -12,39 +12,20 @@ package securejoin import ( "bytes" + "errors" "os" "path/filepath" "strings" "syscall" - - "github.com/pkg/errors" ) -// ErrSymlinkLoop is returned by SecureJoinVFS when too many symlinks have been -// evaluated in attempting to securely join the two given paths. -var ErrSymlinkLoop = errors.Wrap(syscall.ELOOP, "secure join") - // IsNotExist tells you if err is an error that implies that either the path // accessed does not exist (or path components don't exist). This is // effectively a more broad version of os.IsNotExist. func IsNotExist(err error) bool { - // If it's a bone-fide ENOENT just bail. - if os.IsNotExist(errors.Cause(err)) { - return true - } - // Check that it's not actually an ENOTDIR, which in some cases is a more // convoluted case of ENOENT (usually involving weird paths). - var errno error - switch err := errors.Cause(err).(type) { - case *os.PathError: - errno = err.Err - case *os.LinkError: - errno = err.Err - case *os.SyscallError: - errno = err.Err - } - return errno == syscall.ENOTDIR || errno == syscall.ENOENT + return errors.Is(err, os.ErrNotExist) || errors.Is(err, syscall.ENOTDIR) || errors.Is(err, syscall.ENOENT) } // SecureJoinVFS joins the two given path components (similar to Join) except @@ -68,7 +49,7 @@ func SecureJoinVFS(root, unsafePath string, vfs VFS) (string, error) { n := 0 for unsafePath != "" { if n > 255 { - return "", ErrSymlinkLoop + return "", &os.PathError{Op: "SecureJoin", Path: root + "/" + unsafePath, Err: syscall.ELOOP} } // Next path component, p. |