mirror of
				https://github.com/coredns/coredns.git
				synced 2025-11-03 18:53:13 -05:00 
			
		
		
		
	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.
		
			
				
	
	
		
			20 lines
		
	
	
		
			344 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			20 lines
		
	
	
		
			344 B
		
	
	
	
		
			Go
		
	
	
	
	
	
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)
 | 
						|
}
 |