]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsreplay: Bail out on a too small outgoing buffer 6575/head
authorRemi Gacogne <remi.gacogne@powerdns.com>
Tue, 5 Dec 2017 16:07:19 +0000 (17:07 +0100)
committerPeter van Dijk <peter.van.dijk@powerdns.com>
Mon, 7 May 2018 12:54:10 +0000 (14:54 +0200)
pdns/dnsreplay.cc

index 4c5f218c99a17b890c2815c4e7fdffda05566770..a671472f6f5613034c50c891008bfc287b572f0f 100644 (file)
@@ -595,7 +595,7 @@ static void addECSOption(char* packet, const size_t& packetSize, uint16_t* len,
 
   uint16_t arcount = ntohs(dh->arcount);
   /* does it fit in the existing buffer? */
-  if (packetSize - *len > EDNSRR.size()) {
+  if (packetSize > *len && packetSize - *len > EDNSRR.size()) {
     arcount++;
     dh->arcount = htons(arcount);
     memcpy(packet + *len, EDNSRR.c_str(), EDNSRR.size());