From: Bjørn Erik Pedersen Date: Sat, 30 Jul 2016 17:54:07 +0000 (+0200) Subject: Add sanity check to the file walker X-Git-Tag: v0.17~202 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=94d998989d85c0d4f8119d49ba6247367b5f1cd7;p=brevno-suite%2Fhugo 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. --- diff --git a/helpers/path.go b/helpers/path.go index 1d3419fb..91017d51 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)