From 9085c3b73d3edb81f09478356d47e77ee89bbe46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=96stanb=C3=A4ck?= Date: Tue, 30 May 2017 05:28:38 +0200 Subject: [PATCH] repo/download: fix for downloading zero bytes files. (#4436) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Allocated buffer served to client and not properly truncated to number of bytes read. Signed-off-by: Jonas Östanbäck --- routers/repo/download.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routers/repo/download.go b/routers/repo/download.go index a1ad3effe..f5fa1fc44 100644 --- a/routers/repo/download.go +++ b/routers/repo/download.go @@ -18,7 +18,7 @@ import ( func ServeData(ctx *context.Context, name string, reader io.Reader) error { buf := make([]byte, 1024) n, _ := reader.Read(buf) - if n > 0 { + if n >= 0 { buf = buf[:n] }