Add limit to ioutil.ReadAll for request body (#5224)

This PR adds limit to ioutil.ReadAll for DoH request body
so that it will not be subject to large requests.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
This commit is contained in:
Yong Tang 2022-03-04 12:18:05 -08:00 committed by GitHub
parent 967814161a
commit ad41112a92
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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