From 905f5e7417389865b0dc15ea3bc43fe381132306 Mon Sep 17 00:00:00 2001 From: Yann Hamon Date: Sun, 15 Nov 2020 17:08:45 +0100 Subject: [PATCH] set max resource size --- pkg/resource/files.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/resource/files.go b/pkg/resource/files.go index dbe506a..6b443ac 100644 --- a/pkg/resource/files.go +++ b/pkg/resource/files.go @@ -77,6 +77,9 @@ func FromFiles(ctx context.Context, ignoreFilePatterns []string, paths ...string } scanner := bufio.NewScanner(f) + const maxResourceSize = 4 * 1024 * 1024 // 4MB ought to be enough for everybody + buf := make([]byte, maxResourceSize) + scanner.Buffer(buf, maxResourceSize) scanner.Split(SplitYAMLDocument) nRes := 0 for res := scanner.Scan(); res != false; res = scanner.Scan() {