Skip to content

Commit aad9c8f

Browse files
committed
Limit the query body size
1 parent 5d6f935 commit aad9c8f

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

dnscrypt-proxy/local-doh.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package main
22

33
import (
44
"crypto/tls"
5+
"io"
56
"io/ioutil"
67
"net"
78
"net/http"
@@ -31,7 +32,7 @@ func (handler localDoHHandler) ServeHTTP(writer http.ResponseWriter, request *ht
3132
return
3233
}
3334
xClientAddr := net.Addr(clientAddr)
34-
packet, err := ioutil.ReadAll(request.Body)
35+
packet, err := ioutil.ReadAll(io.LimitReader(request.Body, MaxHTTPBodyLength))
3536
if err != nil {
3637
dlog.Warnf("No body in a local DoH query")
3738
return

0 commit comments

Comments
 (0)