Flag bad rdlength as an error
This commit is contained in:
parent
78619c08e4
commit
8adb7c519c
|
@ -215,8 +215,8 @@ Flags:
|
|||
doXfr(c, m, nameserver)
|
||||
continue
|
||||
}
|
||||
Redo:
|
||||
r, rtt, e := c.Exchange(m, nameserver)
|
||||
Redo:
|
||||
if e != nil {
|
||||
fmt.Printf(";; %s\n", e.Error())
|
||||
continue
|
||||
|
|
5
msg.go
5
msg.go
|
@ -1097,7 +1097,7 @@ func UnpackRR(msg []byte, off int) (rr RR, off1 int, err error) {
|
|||
}
|
||||
off, err = UnpackStruct(rr, msg, off0)
|
||||
if off != end {
|
||||
return &h, end, nil
|
||||
return &h, end, &Error{Err: "bad rdlength"}
|
||||
}
|
||||
return rr, off, err
|
||||
}
|
||||
|
@ -1306,7 +1306,8 @@ func (dns *Msg) Unpack(msg []byte) (err error) {
|
|||
}
|
||||
if off != len(msg) {
|
||||
// TODO(mg) remove eventually
|
||||
// println("extra bytes in dns packet", off, "<", len(msg))
|
||||
// Err: extra bytes in packet
|
||||
println("dns: extra bytes in dns packet", off, "<", len(msg))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
7
types.go
7
types.go
|
@ -519,12 +519,15 @@ func (rr *SPF) Header() *RR_Header { return &rr.Hdr }
|
|||
func (rr *SPF) Copy() RR { return &SPF{*rr.Hdr.CopyHeader(), rr.Txt} }
|
||||
|
||||
func (rr *SPF) String() string {
|
||||
println("DDSDDSDS")
|
||||
s := rr.Hdr.String()
|
||||
println("LENGTH", len(rr.Txt))
|
||||
for i, s1 := range rr.Txt {
|
||||
println(i, "DDDSDS")
|
||||
if i > 0 {
|
||||
s += " " + "\"" + s1 + "\""
|
||||
s += " " + strconv.QuoteToASCII(s1)
|
||||
} else {
|
||||
s += "\"" + s1 + "\""
|
||||
s += strconv.QuoteToASCII(s1)
|
||||
}
|
||||
}
|
||||
return s
|
||||
|
|
Loading…
Reference in New Issue