From: Bert Hubert Date: Thu, 19 Aug 2010 18:31:46 +0000 (+0000) Subject: improve reporting of error condition in comparing packets + prevent one error condition X-Git-Tag: rec-3.3~28 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=318f1e479096cca074cb066662c67f0a30a69b24;p=pdns improve reporting of error condition in comparing packets + prevent one error condition git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@1691 d19b8d6e-7fed-0310-83ef-9ca221ded41b --- diff --git a/pdns/dns.cc b/pdns/dns.cc index c0a47739e..98d52baa7 100644 --- a/pdns/dns.cc +++ b/pdns/dns.cc @@ -3,6 +3,7 @@ #include #include #include +#include static void appendEscapedLabel(string& ret, const char* begin, unsigned char labellen) { @@ -37,7 +38,7 @@ public: { if(offset < d_length) return d_ptr[offset]; - else throw runtime_error("out of bounds"); + else throw runtime_error("out of bounds: "+boost::lexical_cast(offset)+" >= " + boost::lexical_cast(d_length)); } private: const char* d_ptr; @@ -48,7 +49,8 @@ private: bool dnspacketLessThan(const std::string& a, const std::string& b) { if(a.length() < 12 || b.length() < 12) - throw runtime_error("Error parsing question in dnspacket comparison: packet too short"); + return a.length() < b.length(); +// throw runtime_error("Error parsing question in dnspacket comparison: packet too short"); // we find: 3www4ds9a2nl0XXYY, where XX and YY are each 2 bytes describing class and type