mirror of
https://github.com/miekg/dns.git
synced 2025-12-16 17:21:17 +01:00
Fix unpacking
This commit is contained in:
parent
e745789a1e
commit
1995ce2be4
2
types.go
2
types.go
@ -1541,7 +1541,7 @@ func (rr *CAA) len() int { return rr.Hdr.len() + 1 + len(rr.Tag) + len
|
|||||||
func (rr *CAA) String() string {
|
func (rr *CAA) String() string {
|
||||||
s := rr.Hdr.String()
|
s := rr.Hdr.String()
|
||||||
|
|
||||||
s += "\\# " + strconv.Itoa(2 + len(rr.Tag) + len(rr.Value)) + " "
|
s += "\\# " + strconv.Itoa(2 + len(rr.Tag) + len(rr.Value)/2) + " "
|
||||||
s += fmt.Sprintf("%02X%02X%X%s", rr.Flag, len(rr.Tag), rr.Tag, strings.ToUpper(rr.Value))
|
s += fmt.Sprintf("%02X%02X%X%s", rr.Flag, len(rr.Tag), rr.Tag, strings.ToUpper(rr.Value))
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2208,12 +2208,14 @@ func setCAA(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) {
|
|||||||
return nil, &ParseError{f, "bad CAA Tag length", l}, ""
|
return nil, &ParseError{f, "bad CAA Tag length", l}, ""
|
||||||
}
|
}
|
||||||
|
|
||||||
tag, e := hex.DecodeString(s[4:4+taglength])
|
tag, e := hex.DecodeString(s[4:4+(taglength*2)])
|
||||||
if e != nil {
|
if e != nil {
|
||||||
return nil, &ParseError{f, "bad CAA Tag", l}, ""
|
return nil, &ParseError{f, "bad CAA Tag", l}, ""
|
||||||
}
|
}
|
||||||
rr.Tag = string(tag)
|
rr.Tag = string(tag)
|
||||||
|
|
||||||
|
rr.Value = s[4+(taglength*2):]
|
||||||
|
|
||||||
return rr, nil, c1
|
return rr, nil, c1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user