]> granicus.if.org Git - pdns/commitdiff
Require that all text data is consumed when parsing records
authorAki Tuomi <cmouse@desteem.org>
Thu, 24 Apr 2014 14:24:28 +0000 (17:24 +0300)
committerAki Tuomi <cmouse@desteem.org>
Thu, 24 Apr 2014 14:24:28 +0000 (17:24 +0300)
pdns/dnsparser.hh
pdns/dnsrecords.hh
pdns/dnswriter.hh
pdns/rcpgenerator.hh

index e5686b06f5acf91cfa4f416e7e177b0201a270f2..20436ecbab2c911392bbbb049e175fef2e29a486 100644 (file)
@@ -143,6 +143,8 @@ public:
 
   uint16_t d_pos;
 
+  bool eof() { return true; };
+
 private:
   uint16_t d_startrecordpos; // needed for getBlob later on
   uint16_t d_recordlen;      // ditto
index fd2197cc8826bf2ac42a9c9cceff457018b0db52..893f71a9f08596001ca826bc8a55f5fd3726e471 100644 (file)
@@ -601,6 +601,7 @@ template<class Convertor>                                         \
 void RNAME##RecordContent::xfrPacket(Convertor& conv)             \
 {                                                                 \
   CONV;                                                           \
+  if (conv.eof() == false) throw MOADNSException("All data was not consumed"); \
 }                                                                 \
 
 struct EDNSOpts
index 17976bef00247a4af78acebcf08747f79b31f2bc..1ea68a9e772974e3736cb41a000af795e92f0a56 100644 (file)
@@ -110,6 +110,7 @@ public:
   {
     return d_content;
   }
+  bool eof() { return true; } // we don't know how long the record should be
 
 private:
   vector <uint8_t>& d_content;
index b3bca592515bcda472f9d2becbda87c0b9b21737..040ce7f51da4b573f310e189bba51b369fd6a520 100644 (file)
@@ -85,7 +85,7 @@ public:
   void xfrText(const string& val, bool multi=false);
   void xfrBlob(const string& val, int len=-1);
   void xfrHexBlob(const string& val, bool keepReading=false);
-
+  bool eof() { return true; };
 private:
   string& d_string;
 };