summaryrefslogtreecommitdiffstats
path: root/helpers/path.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2016-07-30 19:54:07 +0200
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2016-07-30 19:54:07 +0200
commit94d998989d85c0d4f8119d49ba6247367b5f1cd7 (patch)
tree028afe6d88c873a4d61759c190dd9276277e7b06 /helpers/path.go
parent802d43cbfdb053adb1e0dc72e7b0ae0174c24525 (diff)
Add sanity check to the file walker
As more tests now hit the virtual filesystem, add this check to prevent any walking of the entire file system.
Diffstat (limited to 'helpers/path.go')
-rw-r--r--helpers/path.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/helpers/path.go b/helpers/path.go
index 1d3419fb2..91017d513 100644
--- a/helpers/path.go
+++ b/helpers/path.go
@@ -467,6 +467,11 @@ func FindCWD() (string, error) {
// the file structure
func SymbolicWalk(fs afero.Fs, root string, walker filepath.WalkFunc) error {
+ // Sanity check
+ if len(root) < 5 {
+ return fmt.Errorf("Path to short, cannot walk the root: %s", root)
+ }
+
// Handle the root first
fileInfo, err := lstatIfOs(fs, root)