diff --git a/internal/vkgo/rpc/statshouse.go b/internal/vkgo/rpc/statshouse.go index d0092eb2e..f5701c413 100644 --- a/internal/vkgo/rpc/statshouse.go +++ b/internal/vkgo/rpc/statshouse.go @@ -221,16 +221,18 @@ func forwardPacketBody(dst, src *PacketConn, header *packetHeader, buf []byte) ( return res } // skip padding - if n := int(-header.length & 3); n != 0 { - if _, err := io.ReadFull(src.r, src.headerReadBuf[:n]); err != nil { - res.ReadErr = err - return res - } - for i := 0; i < n; i++ { - if src.headerReadBuf[i] != 0 { - res.ReadErr = errNonZeroPadding + if src.w.isEncrypted() { + if n := int(-header.length & 3); n != 0 { + if _, err := io.ReadFull(src.r, src.headerReadBuf[:n]); err != nil { + res.ReadErr = err return res } + for i := 0; i < n; i++ { + if src.headerReadBuf[i] != 0 { + res.ReadErr = errNonZeroPadding + return res + } + } } } return res