From: Remi Gacogne Date: Fri, 31 Jul 2020 14:16:49 +0000 (+0200) Subject: dnsdist: Check the responder's payload < the incoming buffer size X-Git-Tag: rec-4.4.0-beta1~46^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F9049%2Fhead;p=thirdparty%2Fpdns.git dnsdist: Check the responder's payload < the incoming buffer size --- diff --git a/pdns/dnsdist-ecs.cc b/pdns/dnsdist-ecs.cc index 02cd7bd14c..6dfdbbc8f2 100644 --- a/pdns/dnsdist-ecs.cc +++ b/pdns/dnsdist-ecs.cc @@ -30,7 +30,9 @@ /* when we add EDNS to a query, we don't want to advertise a large buffer size */ size_t g_EdnsUDPPayloadSize = 512; -uint16_t g_PayloadSizeSelfGenAnswers{1232}; +static const uint16_t defaultPayloadSizeSelfGenAnswers = 1232; +static_assert(defaultPayloadSizeSelfGenAnswers < s_udpIncomingBufferSize, "The UDP responder's payload size should be smaller or equal to our incoming buffer size"); +uint16_t g_PayloadSizeSelfGenAnswers{defaultPayloadSizeSelfGenAnswers}; /* draft-ietf-dnsop-edns-client-subnet-04 "11.1. Privacy" */ uint16_t g_ECSSourcePrefixV4 = 24;