From ac4e389b128b95ce4edb97a086c86020066b982b Mon Sep 17 00:00:00 2001 From: Pieter Lexis Date: Tue, 20 Feb 2018 18:06:46 +0100 Subject: [PATCH] recursor: Check size when adding the OPT RR --- pdns/pdns_recursor.cc | 4 ++++ 1 file changed, 4 insertions(+) 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(); } -- 2.47.3