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
+2
-2
@@ -14,7 +14,7 @@ import (
|
||||
)
|
||||
|
||||
// HandleFunc function handles the dns TypeA or TypeAAAA answer.
|
||||
type HandleFunc func(Domain, ip string) error
|
||||
type HandleFunc func(domain, ip string) error
|
||||
|
||||
// Config for dns.
|
||||
type Config struct {
|
||||
@@ -55,7 +55,7 @@ func NewClient(proxy proxy.Proxy, config *Config) (*Client, error) {
|
||||
}
|
||||
|
||||
// Exchange handles request message and returns response message.
|
||||
// reqBytes = reqLen + reqMsg
|
||||
// NOTE: reqBytes = reqLen + reqMsg.
|
||||
func (c *Client) Exchange(reqBytes []byte, clientAddr string, preferTCP bool) ([]byte, error) {
|
||||
req, err := UnmarshalMessage(reqBytes[2:])
|
||||
if err != nil {
|
||||
|
||||
Reference in new issue
Block a user