mirror of
https://github.com/coredns/coredns.git
synced 2025-10-28 08:44:17 -04:00
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:
@@ -92,7 +92,7 @@ func requestToMsgGet(req *http.Request) (*dns.Msg, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func toMsg(r io.ReadCloser) (*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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user