diff --git a/pkg/sentry/socket/hostinet/socket.go b/pkg/sentry/socket/hostinet/socket.go index 4357bdee2..ba8a4ce3e 100644 --- a/pkg/sentry/socket/hostinet/socket.go +++ b/pkg/sentry/socket/hostinet/socket.go @@ -410,6 +410,10 @@ func (s *socketOpsCommon) GetSockOpt(t *kernel.Task, level int, name int, optVal optlen = sizeofInt32 case linux.TCP_INFO: optlen = linux.SizeOfTCPInfo + // Truncate the output buffer to outLen size. + if optlen > outLen { + optlen = outLen + } case linux.TCP_CONGESTION: optlen = outLen }