summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/socket
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2020-03-03 00:34:05 +0000
committergVisor bot <gvisor-bot@google.com>2020-03-03 00:34:05 +0000
commit397bab97367e3fcea9f3b5c87c72849d51a261b8 (patch)
tree4fe9c737254204740bee24e411519dd8564fd152 /pkg/sentry/socket
parentc78bb6b97c767f054c6967b390a95450456d2dde (diff)
parent43abb24657e737dee1108ff0d512b2e1b6d8a3f6 (diff)
Merge release-20200219.0-84-g43abb24 (automated)
Diffstat (limited to 'pkg/sentry/socket')
-rwxr-xr-xpkg/sentry/socket/netstack/netstack.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/pkg/sentry/socket/netstack/netstack.go b/pkg/sentry/socket/netstack/netstack.go
index 1eeb37446..13a9a60b4 100755
--- a/pkg/sentry/socket/netstack/netstack.go
+++ b/pkg/sentry/socket/netstack/netstack.go
@@ -712,6 +712,10 @@ func (s *SocketOperations) Connect(t *kernel.Task, sockaddr []byte, blocking boo
// Bind implements the linux syscall bind(2) for sockets backed by
// tcpip.Endpoint.
func (s *SocketOperations) Bind(t *kernel.Task, sockaddr []byte) *syserr.Error {
+ if len(sockaddr) < 2 {
+ return syserr.ErrInvalidArgument
+ }
+
family := usermem.ByteOrder.Uint16(sockaddr)
var addr tcpip.FullAddress