added http.reader maximum buffer check

This commit is contained in:
xdrm-brackets 2018-04-26 10:24:00 +02:00
parent 7db4d2ee1f
commit c4863e396b
1 changed files with 5 additions and 0 deletions

View File

@ -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)