Skip to content

Commit

Permalink
net: report port number correctly in Plan 9 error
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
ianlancetaylor committed Feb 28, 2020
1 parent 2cf3eba commit 719b1ba
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/net/ipsock_plan9.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 719b1ba

Please sign in to comment.