]> Cypherpunks repositories - gostls13.git/commitdiff
net: disallow dialing and listening on port > 65535 on Plan 9
authorDavid du Colombier <0intro@gmail.com>
Thu, 3 Nov 2016 10:50:45 +0000 (11:50 +0100)
committerDavid du Colombier <0intro@gmail.com>
Thu, 3 Nov 2016 13:58:02 +0000 (13:58 +0000)
Since Dial(":80") was implemented on Plan 9 (CL 32593),
TestProtocolDialError is failing because dialing a port
superior to 65535 is supported on Plan 9.

This change disallows dialing and listening on ports
superior to 65535.

Fixes #17761.

Change-Id: I95e8a163eeacf1ccd8ece7b650f16a0531c59709
Reviewed-on: https://go-review.googlesource.com/32594
Reviewed-by: Russ Cox <rsc@golang.org>
src/net/ipsock_plan9.go

index 7046a05f344456cada83ce307ff06d6357077d34..b7fd344c8ad4a931fce68286f3b58e56a9101807 100644 (file)
@@ -119,6 +119,11 @@ func startPlan9(ctx context.Context, net string, addr Addr) (ctl *os.File, dest,
                return
        }
 
+       if port > 65535 {
+               err = InvalidAddrError("port should be < 65536")
+               return
+       }
+
        clone, dest, err := queryCS1(ctx, proto, ip, port)
        if err != nil {
                return