]> granicus.if.org Git - pdns/commitdiff
make sure we don't encode the root label in EDNS0 for root queries as c00c, upsets...
authorbert hubert <bert.hubert@netherlabs.nl>
Mon, 18 Aug 2014 14:35:56 +0000 (16:35 +0200)
committerbert hubert <bert.hubert@netherlabs.nl>
Mon, 18 Aug 2014 14:35:56 +0000 (16:35 +0200)
pdns/dnswriter.cc

index 594e616ce540fc793fa9ac2bd4ddac5429b353f8..8984e50bed6623cd17a2c5b7b936595bd7c9aeaf 100644 (file)
@@ -68,7 +68,7 @@ void DNSPacketWriter::startRecord(const string& name, uint16_t qtype, uint32_t t
   d_stuff = 0;
   d_rollbackmarker=d_content.size();
 
-  if(compress && pdns_iequals(d_qname, d_recordqname)) {  // don't do the whole label compression thing if we *know* we can get away with "see question"
+  if(compress && !d_recordqname.empty() && pdns_iequals(d_qname, d_recordqname)) {  // don't do the whole label compression thing if we *know* we can get away with "see question" - except when compressing the root
     static unsigned char marker[2]={0xc0, 0x0c};
     d_content.insert(d_content.end(), (const char *) &marker[0], (const char *) &marker[2]);
   }