diff --git a/pdns/dnspacket.cc b/pdns/dnspacket.cc index e1583ca34231..66f73a5e04cf 100644 --- a/pdns/dnspacket.cc +++ b/pdns/dnspacket.cc @@ -559,7 +559,10 @@ try if(getEDNSOpts(mdp, &edo)) { d_haveednssection=true; - d_maxreplylen=std::min(edo.d_packetsize, s_udpTruncationThreshold); + /* rfc6891 6.2.3: + "Values lower than 512 MUST be treated as equal to 512." + */ + d_maxreplylen=std::min(std::max(static_cast(512), edo.d_packetsize), s_udpTruncationThreshold); // cerr<