fuzz-walker/walker/walkers/readFuzz/fuzz.go
Vincent Batts 66e91e3ddf
default to compile in, but also allow plugins
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2018-06-06 12:29:33 -04:00

30 lines
413 B
Go

package readFuzz
import (
"io"
"io/ioutil"
"os"
"git.thisco.de/vbatts/fuzz-walker/walker"
)
func init() {
walker.RegisterFuzzFunc(Name, FuzzFunc)
}
const Name = "readFuzz"
func FuzzFunc(path string, info os.FileInfo) error {
if !info.Mode().IsRegular() {
return nil
}
fd, err := os.Open(path)
if err != nil {
return err
}
defer fd.Close()
_, err = io.Copy(ioutil.Discard, fd)
return err
}