From 719b1ba27822e01cbef0d418d26a321a25948313 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Thu, 27 Feb 2020 07:36:39 -0800 Subject: [PATCH] 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 --- src/net/ipsock_plan9.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 } -- 2.50.0