Skip to content

Commit 719b1ba

Browse files
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 <[email protected]> Reviewed-by: Bryan C. Mills <[email protected]> TryBot-Result: Gobot Gobot <[email protected]>
1 parent 2cf3eba commit 719b1ba

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/net/ipsock_plan9.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,12 @@ func parsePlan9Addr(s string) (ip IP, iport int, err error) {
5757
return nil, 0, &ParseError{Type: "IP address", Text: s}
5858
}
5959
}
60-
p, _, ok := dtoi(s[i+1:])
60+
p, plen, ok := dtoi(s[i+1:])
6161
if !ok {
6262
return nil, 0, &ParseError{Type: "port", Text: s}
6363
}
6464
if p < 0 || p > 0xFFFF {
65-
return nil, 0, &AddrError{Err: "invalid port", Addr: string(p)}
65+
return nil, 0, &AddrError{Err: "invalid port", Addr: s[i+1 : i+1+plen]}
6666
}
6767
return addr, p, nil
6868
}

0 commit comments

Comments
 (0)