Add limit to ioutil.ReadAll for request body
This PR adds limit to ioutil.ReadAll for DoH request body
so that it will not be subject to large requests.
@@ -92,7 +92,7 @@ func requestToMsgGet(req *http.Request) (*dns.Msg, error) {
}
func toMsg(r io.ReadCloser) (*dns.Msg, error) {
- buf, err := io.ReadAll(r)
+ buf, err := io.ReadAll(io.LimitReader(r, 65536))
if err != nil {
return nil, err
}
