Fix the CAA type

This commit is contained in:
Miek Gieben 2013-09-27 08:51:20 +00:00
parent 4e6b3a5afc
commit 67065da09c
2 changed files with 4 additions and 12 deletions

2
msg.go
View File

@ -756,7 +756,7 @@ func unpackStructValue(val reflect.Value, msg []byte, off int) (off1 int, err er
break
}
l := int(msg[off])
if off+l+1 > lenmsg {
if off+l+1 > lenmsg { // TODO(miek): +1 or ... not ...
return lenmsg, &Error{err: "overflow unpacking txt"}
}
txt = append(txt, string(msg[off+1:off+l+1]))

View File

@ -1385,7 +1385,7 @@ type CAA struct {
Hdr RR_Header
Flag uint8
Tag string
Value []string `dns:"txt"`
Value string `dns:"octet"`
}
func (rr *CAA) Header() *RR_Header { return &rr.Hdr }
@ -1393,21 +1393,13 @@ func (rr *CAA) copy() RR { return &CAA{*rr.Hdr.copyHeader(), rr.Flag,
func (rr *CAA) String() string {
s := rr.Hdr.String() + strconv.FormatInt(int64(rr.Flag), 10) + " " + rr.Tag
for i, s1 := range rr.Value {
if i > 0 {
s += " " + strconv.QuoteToASCII(s1)
} else {
s += strconv.QuoteToASCII(s1)
}
}
s += strconv.QuoteToASCII(rr.Value)
return s
}
func (rr *CAA) len() int {
l := rr.Hdr.len() + 1 + len(rr.Tag)
for _, t := range rr.Value {
l += len(t)
}
l += len(rr.Value)
return l
}