From: Aki Tuomi Date: Thu, 24 Apr 2014 14:24:28 +0000 (+0300) Subject: Require that all text data is consumed when parsing records X-Git-Tag: rec-3.6.0-rc1~39^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d476d7fb8f6524ea462d737d973235193d0a10e8;p=thirdparty%2Fpdns.git Require that all text data is consumed when parsing records --- diff --git a/pdns/dnsparser.hh b/pdns/dnsparser.hh index e5686b06f5..20436ecbab 100644 --- a/pdns/dnsparser.hh +++ b/pdns/dnsparser.hh @@ -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 diff --git a/pdns/dnsrecords.hh b/pdns/dnsrecords.hh index fd2197cc88..893f71a9f0 100644 --- a/pdns/dnsrecords.hh +++ b/pdns/dnsrecords.hh @@ -601,6 +601,7 @@ template \ void RNAME##RecordContent::xfrPacket(Convertor& conv) \ { \ CONV; \ + if (conv.eof() == false) throw MOADNSException("All data was not consumed"); \ } \ struct EDNSOpts diff --git a/pdns/dnswriter.hh b/pdns/dnswriter.hh index 17976bef00..1ea68a9e77 100644 --- a/pdns/dnswriter.hh +++ b/pdns/dnswriter.hh @@ -110,6 +110,7 @@ public: { return d_content; } + bool eof() { return true; } // we don't know how long the record should be private: vector & d_content; diff --git a/pdns/rcpgenerator.hh b/pdns/rcpgenerator.hh index b3bca59251..040ce7f51d 100644 --- a/pdns/rcpgenerator.hh +++ b/pdns/rcpgenerator.hh @@ -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; };