Skip to content

Commit 692e2e5

Browse files
committed
fix: use bufio reader instead of raw conn in vsock proxy bidirectional copy
In handleVsockConnection, the handshake is read using a bufio.NewReader(conn), but the bidirectional proxy was using io.Copy(guestConn, conn) which reads from the raw conn. Any data buffered by the bufio.Reader beyond the handshake line would be silently lost. Use the buffered reader instead, consistent with the client-side implementations in vsock.go that use bufferedConn wrappers.
1 parent 9985f40 commit 692e2e5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cmd/vz-shim/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ func (s *ShimServer) handleVsockConnection(conn net.Conn) {
246246
done := make(chan struct{}, 2)
247247

248248
go func() {
249-
io.Copy(guestConn, conn)
249+
io.Copy(guestConn, reader)
250250
done <- struct{}{}
251251
}()
252252

0 commit comments

Comments
 (0)