From 59b792bf8a814ad5d7810c51a18e9f618153ace8 Mon Sep 17 00:00:00 2001 From: Ayman Bagabas Date: Fri, 26 Apr 2024 18:39:34 -0400 Subject: plumbing: fix sideband demux on flush Canonical Git implementation terminates the sideband stream with a flush. If the demux scanner is not terminated, it can hang the connection. Returns io.EOF when encountering a flush pkt. https://github.com/git/git/blob/master/upload-pack.c#L460 --- plumbing/protocol/packp/sideband/demux.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plumbing/protocol/packp/sideband/demux.go') diff --git a/plumbing/protocol/packp/sideband/demux.go b/plumbing/protocol/packp/sideband/demux.go index 0116f96..01d95a3 100644 --- a/plumbing/protocol/packp/sideband/demux.go +++ b/plumbing/protocol/packp/sideband/demux.go @@ -114,7 +114,7 @@ func (d *Demuxer) nextPackData() ([]byte, error) { size := len(content) if size == 0 { - return nil, nil + return nil, io.EOF } else if size > d.max { return nil, ErrMaxPackedExceeded } -- cgit