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:
parent
967814161a
commit
ad41112a92
1 changed files with 1 additions and 1 deletions
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue