mirror of
https://github.com/nadoo/glider.git
synced 2026-11-19 07:09:42 +08:00
dns: add length check to avoid panic
This commit is contained in:
1 parent
665d722d2c
commit
e3c57ba369
6 files changed
+20
-55
No files matched your search
@@ -403,6 +403,10 @@ func MarshalDomainTo(w io.Writer, domain string) (int, error) {
|
||||
|
||||
// UnmarshalDomain gets domain from bytes.
|
||||
func (m *Message) UnmarshalDomain(b []byte) (string, int, error) {
|
||||
if len(b) < 2 {
|
||||
return "", 0, errors.New("UnmarshalDomain: not enough size")
|
||||
}
|
||||
|
||||
var idx, size int
|
||||
var labels = []string{}
|
||||
|
||||
|
||||
Reference in new issue
Block a user