mirror of
https://github.com/coredns/coredns.git
synced 2025-12-07 02:45:11 -05:00
fuzzing: allow setup function to be called (#3175)
This allows to fuzzing of more interesting targets that require setup. Signed-off-by: Miek Gieben <miek@miek.nl>
This commit is contained in:
@@ -11,7 +11,12 @@ import (
|
||||
)
|
||||
|
||||
// Do will fuzz p - used by gofuzz. See Makefile.fuzz for comments and context.
|
||||
func Do(p plugin.Handler, data []byte) int {
|
||||
func Do(p plugin.Handler, fn SetupFunc, data []byte) int {
|
||||
if fn != nil {
|
||||
if err := fn(); err != nil {
|
||||
panic("fuzz: " + err.Error())
|
||||
}
|
||||
}
|
||||
ctx := context.TODO()
|
||||
r := new(dns.Msg)
|
||||
if err := r.Unpack(data); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user