From b131708cd611f680ef1094258f4b9ad63de584ca Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Tue, 2 Feb 2021 09:48:11 +0100 Subject: [PATCH] Update miekg/dns --- go.mod | 6 +++--- go.sum | 10 ++++------ vendor/github.com/miekg/dns/dns.go | 9 +++++++-- vendor/github.com/miekg/dns/msg.go | 11 +++++++++-- vendor/github.com/miekg/dns/scan_rr.go | 4 ++-- vendor/github.com/miekg/dns/version.go | 2 +- vendor/github.com/powerman/check/check.go | 16 ++++++++-------- vendor/modules.txt | 4 ++-- 8 files changed, 36 insertions(+), 26 deletions(-) diff --git a/go.mod b/go.mod index 59c02225..54c4e3b3 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/DNSCrypt/dnscrypt-proxy -go 1.15 +go 1.16 require ( github.com/BurntSushi/toml v0.3.1 @@ -17,8 +17,8 @@ require ( github.com/jedisct1/xsecretbox v0.0.0-20210102102453-4ecb2081017a github.com/k-sone/critbitgo v1.4.0 github.com/kardianos/service v1.2.0 - github.com/miekg/dns v1.1.37 - github.com/powerman/check v1.3.0 + github.com/miekg/dns v1.1.38 + github.com/powerman/check v1.3.1 golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad golang.org/x/net v0.0.0-20210119194325-5f4716e94777 golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c diff --git a/go.sum b/go.sum index 5a323cf4..de1c8fb6 100644 --- a/go.sum +++ b/go.sum @@ -17,7 +17,6 @@ github.com/dchest/safefile v0.0.0-20151022103144-855e8d98f185 h1:3T8ZyTDp5QxTx3N github.com/dchest/safefile v0.0.0-20151022103144-855e8d98f185/go.mod h1:cFRxtTwTOJkz2x3rQUNCYKWC93yP1VKjR8NUhqFxZNU= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -65,14 +64,14 @@ github.com/k-sone/critbitgo v1.4.0 h1:l71cTyBGeh6X5ATh6Fibgw3+rtNT80BA0uNNWgkPrb github.com/k-sone/critbitgo v1.4.0/go.mod h1:7E6pyoyADnFxlUBEKcnfS49b7SUAQGMK+OAp/UQvo0s= github.com/kardianos/service v1.2.0 h1:bGuZ/epo3vrt8IPC7mnKQolqFeYJb7Cs8Rk4PSOBB/g= github.com/kardianos/service v1.2.0/go.mod h1:CIMRFEJVL+0DS1a3Nx06NaMn4Dz63Ng6O7dl0qH0zVM= -github.com/miekg/dns v1.1.37 h1:+kky2ArpBqk0S/74RkwFjmKM9jja7AB1RN7VUuVq0iM= -github.com/miekg/dns v1.1.37/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM= +github.com/miekg/dns v1.1.38 h1:MtIY+fmHUVVgv1AXzmKMWcwdCYxTRPG1EDjpqF4RCEw= +github.com/miekg/dns v1.1.38/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/powerman/check v1.3.0 h1:GsncV4RbbC4nZEzLTVpUIdp1rgZil4N36D/XuPZUA60= -github.com/powerman/check v1.3.0/go.mod h1:k/8NCUQwepaKJKctBBKjQo84jvGEvKiumD9pDl87RB0= +github.com/powerman/check v1.3.1 h1:86xiEjMNn0K4b3bhQsLfrLqJb0DWLXHBK3wBd5PoJH4= +github.com/powerman/check v1.3.1/go.mod h1:k/8NCUQwepaKJKctBBKjQo84jvGEvKiumD9pDl87RB0= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/assertions v1.0.1 h1:voD4ITNjPL5jjBfgR/r8fPIIBrliWrWHeiJApdr3r4w= @@ -148,7 +147,6 @@ google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2 google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8= gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= diff --git a/vendor/github.com/miekg/dns/dns.go b/vendor/github.com/miekg/dns/dns.go index 33c93b2b..a88484b0 100644 --- a/vendor/github.com/miekg/dns/dns.go +++ b/vendor/github.com/miekg/dns/dns.go @@ -134,9 +134,14 @@ func (rr *RFC3597) ToRFC3597(r RR) error { // fromRFC3597 converts an unknown RR representation from RFC 3597 to the known RR type. func (rr *RFC3597) fromRFC3597(r RR) error { - *r.Header() = rr.Hdr + hdr := r.Header() + *hdr = rr.Hdr - if len(rr.Rdata) == 0 { + // Can't overflow uint16 as the length of Rdata is validated in (*RFC3597).parse. + // We can only get here when rr was constructed with that method. + hdr.Rdlength = uint16(hex.DecodedLen(len(rr.Rdata))) + + if noRdata(*hdr) { // Dynamic update. return nil } diff --git a/vendor/github.com/miekg/dns/msg.go b/vendor/github.com/miekg/dns/msg.go index 7001f6da..1728a98b 100644 --- a/vendor/github.com/miekg/dns/msg.go +++ b/vendor/github.com/miekg/dns/msg.go @@ -624,11 +624,18 @@ func UnpackRRWithHeader(h RR_Header, msg []byte, off int) (rr RR, off1 int, err rr = &RFC3597{Hdr: h} } - if noRdata(h) { - return rr, off, nil + if off < 0 || off > len(msg) { + return &h, off, &Error{err: "bad off"} } end := off + int(h.Rdlength) + if end < off || end > len(msg) { + return &h, end, &Error{err: "bad rdlength"} + } + + if noRdata(h) { + return rr, off, nil + } off, err = rr.unpack(msg, off) if err != nil { diff --git a/vendor/github.com/miekg/dns/scan_rr.go b/vendor/github.com/miekg/dns/scan_rr.go index 69f10052..23b4043b 100644 --- a/vendor/github.com/miekg/dns/scan_rr.go +++ b/vendor/github.com/miekg/dns/scan_rr.go @@ -1387,7 +1387,7 @@ func (rr *RFC3597) parse(c *zlexer, o string) *ParseError { c.Next() // zBlank l, _ = c.Next() - rdlength, e := strconv.Atoi(l.token) + rdlength, e := strconv.ParseUint(l.token, 10, 16) if e != nil || l.err { return &ParseError{"", "bad RFC3597 Rdata ", l} } @@ -1396,7 +1396,7 @@ func (rr *RFC3597) parse(c *zlexer, o string) *ParseError { if e1 != nil { return e1 } - if rdlength*2 != len(s) { + if int(rdlength)*2 != len(s) { return &ParseError{"", "bad RFC3597 Rdata", l} } rr.Rdata = s diff --git a/vendor/github.com/miekg/dns/version.go b/vendor/github.com/miekg/dns/version.go index ea3401fa..dc80a826 100644 --- a/vendor/github.com/miekg/dns/version.go +++ b/vendor/github.com/miekg/dns/version.go @@ -3,7 +3,7 @@ package dns import "fmt" // Version is current version of this library. -var Version = v{1, 1, 37} +var Version = v{1, 1, 38} // v holds the version of this library. type v struct { diff --git a/vendor/github.com/powerman/check/check.go b/vendor/github.com/powerman/check/check.go index eb8d30e3..b0660f2c 100644 --- a/vendor/github.com/powerman/check/check.go +++ b/vendor/github.com/powerman/check/check.go @@ -689,12 +689,12 @@ func (t *C) NotLen(actual interface{}, expected int, msg ...interface{}) bool { // Checking for nil is okay, but using Nil(actual) instead is more clean. func (t *C) Err(actual, expected error, msg ...interface{}) bool { t.Helper() - actual = unwrapErr(actual) - equal := fmt.Sprintf("%#v", actual) == fmt.Sprintf("%#v", expected) - _, proto1 := actual.(interface{ GRPCStatus() *status.Status }) + actual2 := unwrapErr(actual) + equal := fmt.Sprintf("%#v", actual2) == fmt.Sprintf("%#v", expected) + _, proto1 := actual2.(interface{ GRPCStatus() *status.Status }) _, proto2 := expected.(interface{ GRPCStatus() *status.Status }) if proto1 || proto2 { - equal = proto.Equal(status.Convert(actual).Proto(), status.Convert(expected).Proto()) + equal = proto.Equal(status.Convert(actual2).Proto(), status.Convert(expected).Proto()) } return t.report2(actual, expected, msg, equal) } @@ -729,12 +729,12 @@ func unwrapErr(err error) (actual error) { // same error, and so is both nil. func (t *C) NotErr(actual, expected error, msg ...interface{}) bool { t.Helper() - actual = unwrapErr(actual) - notEqual := fmt.Sprintf("%#v", actual) != fmt.Sprintf("%#v", expected) - _, proto1 := actual.(interface{ GRPCStatus() *status.Status }) + actual2 := unwrapErr(actual) + notEqual := fmt.Sprintf("%#v", actual2) != fmt.Sprintf("%#v", expected) + _, proto1 := actual2.(interface{ GRPCStatus() *status.Status }) _, proto2 := expected.(interface{ GRPCStatus() *status.Status }) if proto1 || proto2 { - notEqual = !proto.Equal(status.Convert(actual).Proto(), status.Convert(expected).Proto()) + notEqual = !proto.Equal(status.Convert(actual2).Proto(), status.Convert(expected).Proto()) } return t.report1(actual, msg, notEqual) } diff --git a/vendor/modules.txt b/vendor/modules.txt index 92b4a80a..45085c42 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -57,14 +57,14 @@ github.com/k-sone/critbitgo # github.com/kardianos/service v1.2.0 ## explicit github.com/kardianos/service -# github.com/miekg/dns v1.1.37 +# github.com/miekg/dns v1.1.38 ## explicit github.com/miekg/dns # github.com/pkg/errors v0.9.1 github.com/pkg/errors # github.com/pmezard/go-difflib v1.0.0 github.com/pmezard/go-difflib/difflib -# github.com/powerman/check v1.3.0 +# github.com/powerman/check v1.3.1 ## explicit github.com/powerman/check # github.com/smartystreets/goconvey v1.6.4