diff options
Diffstat (limited to 'pkg/tcpip/transport')
-rw-r--r-- | pkg/tcpip/transport/tcp/endpoint.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/pkg/tcpip/transport/tcp/endpoint.go b/pkg/tcpip/transport/tcp/endpoint.go index 83ec99fa9..f47b39ccc 100644 --- a/pkg/tcpip/transport/tcp/endpoint.go +++ b/pkg/tcpip/transport/tcp/endpoint.go @@ -1552,10 +1552,11 @@ func (e *endpoint) Write(p tcpip.Payloader, opts tcpip.WriteOptions) (int64, tcp return nil, nil } v := make([]byte, avail) - if _, err := io.ReadFull(p, v); err != nil { + n, err := p.Read(v) + if err != nil && err != io.EOF { return nil, &tcpip.ErrBadBuffer{} } - return v, nil + return v[:n], nil }() if len(v) == 0 || err != nil { return nil, 0, err |