mirror of
https://github.com/golang/go
synced 2024-11-23 10:20:03 -07:00
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 <iant@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
2cf3ebaf3d
commit
719b1ba278
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user