mirror of
https://github.com/nadoo/glider.git
synced 2026-11-19 07:09:42 +08:00
dns: check length in UnmarshalDomain to avoid panic
This commit is contained in:
1 parent
a118ec5837
commit
a42d3a68d0
6 files changed
+18
-11
No files matched your search
@@ -415,6 +415,10 @@ func (m *Message) UnmarshalDomain(b []byte) (string, int, error) {
|
||||
break
|
||||
|
||||
} else if b[idx]&0xC0 == 0xC0 {
|
||||
if len(b[idx:]) < 2 {
|
||||
return "", 0, errors.New("UnmarshalDomain: not enough size for compressed domain")
|
||||
}
|
||||
|
||||
offset := binary.BigEndian.Uint16(b[idx : idx+2])
|
||||
label, err := m.UnmarshalDomainPoint(int(offset & 0x3FFF))
|
||||
if err != nil {
|
||||
|
||||
Reference in new issue
Block a user