Limit the query body size

This commit is contained in:
Frank Denis 2019-11-28 23:32:56 +01:00
parent 5d6f9358c9
commit aad9c8f19c
1 changed files with 2 additions and 1 deletions

View File

@ -2,6 +2,7 @@ package main
import (
"crypto/tls"
"io"
"io/ioutil"
"net"
"net/http"
@ -31,7 +32,7 @@ func (handler localDoHHandler) ServeHTTP(writer http.ResponseWriter, request *ht
return
}
xClientAddr := net.Addr(clientAddr)
packet, err := ioutil.ReadAll(request.Body)
packet, err := ioutil.ReadAll(io.LimitReader(request.Body, MaxHTTPBodyLength))
if err != nil {
dlog.Warnf("No body in a local DoH query")
return