ref: 94d998989d85c0d4f8119d49ba6247367b5f1cd7
parent: 802d43cbfdb053adb1e0dc72e7b0ae0174c24525
author: Bjørn Erik Pedersen <[email protected]>
date: Sat Jul 30 15:54:07 EDT 2016
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.
--- a/helpers/path.go
+++ b/helpers/path.go
@@ -467,6 +467,11 @@
// 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)