dns/fuzz_test.go
Miek Gieben 69d043f8ab Better fuzzing test and NSAP fix
rr can be nil when parsed, if it, for instance only contains a
comment.

NSAP parsing need some parens to make the if-then logic work.
2015-08-07 12:17:16 +02:00

21 lines
488 B
Go
Raw Blame History

package dns
import "testing"
func TestFuzzString(t *testing.T) {
testcases := []string{"", " MINFO ", " RP ", " NSEC 0 0", " \" NSEC 0 0\"", " \" MINFO \"",
";a ", ";a<><61><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>",
" NSAP O ", " NSAP N ",
}
for i, tc := range testcases {
rr, err := NewRR(tc)
if err == nil {
// rr can still be nil because we can (for instance) just parse a comment
if rr == nil {
continue
}
t.Fatalf("parsed mailformed RR %d: %s", i, rr.String)
}
}
}