summaryrefslogtreecommitdiff
path: root/src/pkg/net/sock_linux.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/net/sock_linux.go')
-rw-r--r--src/pkg/net/sock_linux.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/pkg/net/sock_linux.go b/src/pkg/net/sock_linux.go
index 8bbd74ddc..cc5ce153b 100644
--- a/src/pkg/net/sock_linux.go
+++ b/src/pkg/net/sock_linux.go
@@ -21,5 +21,11 @@ func maxListenerBacklog() int {
if n == 0 || !ok {
return syscall.SOMAXCONN
}
+ // Linux stores the backlog in a uint16.
+ // Truncate number to avoid wrapping.
+ // See issue 5030.
+ if n > 1<<16-1 {
+ n = 1<<16 - 1
+ }
return n
}