diff --git a/dns_test.go b/dns_test.go index ac37d76b..f91b4597 100644 --- a/dns_test.go +++ b/dns_test.go @@ -316,6 +316,22 @@ func TestMsgLength2(t *testing.T) { } } +func testMsgLengthCompressionMalformed(t *testing.T) { + // SOA with empty hostmaster, which is illegal + soa := &SOA{Hdr: RR_Header{Name: ".", Rrtype: TypeSOA, Class: ClassINET, Ttl: 12345}, + Ns: ".", + Mbox: "", + Serial: 0, + Refresh: 28800, + Retry: 7200, + Expire: 604800, + Minttl: 60} + m := new(Msg) + m.Compress = true + m.Ns = []RR{soa} + m.Len() +} + func BenchmarkMsgLength(b *testing.B) { b.StopTimer() makeMsg := func(question string, ans, ns, e []RR) *Msg {