diff options
author | 2017-09-29 22:28:13 +0100 | |
---|---|---|
committer | 2017-09-29 22:28:13 +0100 | |
commit | 4276d29b81575992bf0c7525b4cb5716d493e913 (patch) | |
tree | 152994cf7cb251f9f46cb8c3b914cb413eda33de /plugin/rewrite | |
parent | 23526aec1d933b6362c80eaa084749a794d43aca (diff) | |
download | coredns-4276d29b81575992bf0c7525b4cb5716d493e913.tar.gz coredns-4276d29b81575992bf0c7525b4cb5716d493e913.tar.zst coredns-4276d29b81575992bf0c7525b4cb5716d493e913.zip |
Add fuzzing infrastructure (#1118)
Fix file/fuzz.go build and docs in Makefile.fuzz
Each plugin can add a fuzz.go to join the fuzzing craze.
pkg/fuzz/do.go could be made a lot smarter, but is probably good enough
for starters.
$ make -f Makefile.fuzz <plugin>
will build with go-fuzz-build and then execute a go-fuzz run. Each
plugin's fuzz run uses a per-plugin directory to store the fuzz data.
Diffstat (limited to 'plugin/rewrite')
-rw-r--r-- | plugin/rewrite/fuzz.go | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/plugin/rewrite/fuzz.go b/plugin/rewrite/fuzz.go new file mode 100644 index 000000000..c268964e3 --- /dev/null +++ b/plugin/rewrite/fuzz.go @@ -0,0 +1,19 @@ +package rewrite + +import ( + "github.com/coredns/coredns/plugin/pkg/fuzz" + + "github.com/mholt/caddy" +) + +// Fuzz fuzzes rewrite. +func Fuzz(data []byte) int { + c := caddy.NewTestController("dns", "rewrite edns0 subnet set 24 56") + rules, err := rewriteParse(c) + if err != nil { + return 0 + } + r := Rewrite{Rules: rules} + + return fuzz.Do(r, data) +} |