From: Ian Lance Taylor Date: Thu, 27 Feb 2020 15:36:39 +0000 (-0800) Subject: net: report port number correctly in Plan 9 error X-Git-Tag: go1.15beta1~1002 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=719b1ba27822e01cbef0d418d26a321a25948313;p=gostls13.git net: report port number correctly in Plan 9 error The code was incorrectly using a string conversion of a numeric port to display the port number. No test because as far as I can tell this code is only executed if there is some error in a /net file. Updates #32479 Change-Id: I0b8deebbf3c0b7cb1e1eee0fd059505f3f4c1623 Reviewed-on: https://go-review.googlesource.com/c/go/+/221377 Run-TryBot: Ian Lance Taylor Reviewed-by: Bryan C. Mills TryBot-Result: Gobot Gobot --- diff --git a/src/net/ipsock_plan9.go b/src/net/ipsock_plan9.go index 93f0f4eec3..eaf3064955 100644 --- a/src/net/ipsock_plan9.go +++ b/src/net/ipsock_plan9.go @@ -57,12 +57,12 @@ func parsePlan9Addr(s string) (ip IP, iport int, err error) { return nil, 0, &ParseError{Type: "IP address", Text: s} } } - p, _, ok := dtoi(s[i+1:]) + p, plen, ok := dtoi(s[i+1:]) if !ok { return nil, 0, &ParseError{Type: "port", Text: s} } if p < 0 || p > 0xFFFF { - return nil, 0, &AddrError{Err: "invalid port", Addr: string(p)} + return nil, 0, &AddrError{Err: "invalid port", Addr: s[i+1 : i+1+plen]} } return addr, p, nil }