]> granicus.if.org Git - pdns/commitdiff
Don't reply to truncated queries
authorChristian Hofstaedtler <christian@hofstaedtler.name>
Mon, 12 Oct 2015 10:14:21 +0000 (12:14 +0200)
committerPeter van Dijk <peter.van.dijk@netherlabs.nl>
Fri, 6 Nov 2015 14:14:17 +0000 (15:14 +0100)
pdns/packethandler.cc

index 2ed23adc206c35cc250cc7f7abdea716f1980f39..6f5c8a6c528664c372e6acad360689edbedc91de 100644 (file)
@@ -1130,6 +1130,14 @@ DNSPacket *PacketHandler::questionOrRecurse(DNSPacket *p, bool *shouldRecurse)
     return 0;
   }
 
+  if(p->d.tc) { // truncated query. MOADNSParser would silently parse this packet in an incomplete way.
+    if(d_logDNSDetails)
+      L<<Logger::Error<<"Received truncated query packet from "<<p->getRemote()<<", dropping"<<endl;
+    S.inc("corrupt-packets");
+    S.ringAccount("remotes-corrupt", p->d_remote);
+    return 0;
+  }
+
   if (p->hasEDNS() && p->getEDNSVersion() > 0) {
     r = p->replyPacket();
     r->setRcode(16 & 0xF);