From c4863e396b5859cabb6730dd2e35752f26a6f6f9 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Thu, 26 Apr 2018 10:24:00 +0200 Subject: [PATCH] added http.reader maximum buffer check --- internal/http/reader/reader.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/internal/http/reader/reader.go b/internal/http/reader/reader.go index 19f9b95..bad8fb2 100644 --- a/internal/http/reader/reader.go +++ b/internal/http/reader/reader.go @@ -6,6 +6,7 @@ package reader // the golang standard library import ( + "fmt" "io" "bufio" ) @@ -55,6 +56,10 @@ func (r *chunkReader) Read() ([]byte, error){ return nil, err } + if len(line) > maxLineLength { + return nil, fmt.Errorf("HTTP line %d exceeded buffer size %d", len(line), maxLineLength) + } + /* (4) Trim */ line = removeTrailingSpace(line)