From: Remi Gacogne Date: Fri, 23 Mar 2018 10:16:03 +0000 (+0100) Subject: ixfr: Get rid of a VLA (and two copies) in getIXFRDeltas() X-Git-Tag: dnsdist-1.3.0~31^2~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=32fc3b0370c1992d1f81e2213d51d773180a0c61;p=thirdparty%2Fpdns.git ixfr: Get rid of a VLA (and two copies) in getIXFRDeltas() --- diff --git a/pdns/ixfr.cc b/pdns/ixfr.cc index 8d02a8bf50..56a69c1df5 100644 --- a/pdns/ixfr.cc +++ b/pdns/ixfr.cc @@ -169,6 +169,7 @@ vector, vector > > getIXFRDeltas(const ComboAd vector records; size_t receivedBytes = 0; int8_t ixfrInProgress = -2; + std::string reply; for(;;) { // IXFR end @@ -186,18 +187,18 @@ vector, vector > > getIXFRDeltas(const ComboAd if (maxReceivedBytes > 0 && (maxReceivedBytes - receivedBytes) < (size_t) len) throw std::runtime_error("Reached the maximum number of received bytes in an IXFR delta for zone '"+zone.toLogString()+"' from master "+master.toStringWithPort()); - char reply[len]; - readn2(s.getHandle(), reply, len); + reply.resize(len); + readn2(s.getHandle(), &reply.at(0), len); receivedBytes += len; - MOADNSParser mdp(false, string(reply, len)); + MOADNSParser mdp(false, reply); if(mdp.d_header.rcode) throw std::runtime_error("Got an error trying to IXFR zone '"+zone.toLogString()+"' from master '"+master.toStringWithPort()+"': "+RCode::to_s(mdp.d_header.rcode)); // cout<<"Got a response, rcode: "<