From 8347576b97915fd0272f2f9dad421c045bd36b4b Mon Sep 17 00:00:00 2001 From: malc0lm Date: Wed, 20 Jun 2018 15:05:48 +0800 Subject: [PATCH] virtcontainer: fix message too long Fixes: #386 Signed-off-by:malc0lm malclee@outlook.com --- virtcontainers/pkg/hyperstart/hyperstart.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/virtcontainers/pkg/hyperstart/hyperstart.go b/virtcontainers/pkg/hyperstart/hyperstart.go index 36474566ef..9aa351ce02 100644 --- a/virtcontainers/pkg/hyperstart/hyperstart.go +++ b/virtcontainers/pkg/hyperstart/hyperstart.go @@ -327,12 +327,8 @@ func ReadCtlMessage(conn net.Conn) (*DecodedMessage, error) { // hyperstart control serial link, use SendCtlMessage. func (h *Hyperstart) WriteCtlMessage(conn net.Conn, m *DecodedMessage) error { length := len(m.Message) + CtlHdrSize - // XXX: Support sending messages by chunks to support messages over - // 10240 bytes. That limit is from hyperstart src/init.c, - // hyper_channel_ops, rbuf_size. - if length > 10240 { - return fmt.Errorf("message too long %d", length) - } + // Since hyper_ctlfd_read() can realloc buffer, we don't limit 10240 + // message size. msg := make([]byte, length) binary.BigEndian.PutUint32(msg[:], m.Code) binary.BigEndian.PutUint32(msg[CtlHdrLenOffset:], uint32(length))