From: Pieter Lexis Date: Tue, 20 Feb 2018 17:06:46 +0000 (+0100) Subject: recursor: Check size when adding the OPT RR X-Git-Tag: dnsdist-1.3.1~50^2~18 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ac4e389b128b95ce4edb97a086c86020066b982b;p=thirdparty%2Fpdns.git recursor: Check size when adding the OPT RR --- diff --git a/pdns/pdns_recursor.cc b/pdns/pdns_recursor.cc index 3b0829e0d4..5947c775a1 100644 --- a/pdns/pdns_recursor.cc +++ b/pdns/pdns_recursor.cc @@ -1304,6 +1304,10 @@ static void startDoResolve(void *p) } } pw.addOpt(g_udpTruncationThreshold, 0, DNSSECOK ? EDNSOpts::DNSSECOK : 0, opts); + if (pw.size() > maxanswersize) { + pw.rollback(); + pw.addOpt(g_udpTruncationThreshold, 0, DNSSECOK ? EDNSOpts::DNSSECOK : 0, opts); + } pw.commit(); }