From: Bert Hubert Date: Mon, 4 Feb 2008 21:44:41 +0000 (+0000) Subject: fix storage of empty unknown records X-Git-Tag: rec-3.1.7.1~112 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4cf74e6f1be87869a1ec3aae3759804ff066c2d6;p=pdns fix storage of empty unknown records git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@1129 d19b8d6e-7fed-0310-83ef-9ca221ded41b --- diff --git a/pdns/dnsparser.cc b/pdns/dnsparser.cc index fabadfa01..5fc84ebb3 100644 --- a/pdns/dnsparser.cc +++ b/pdns/dnsparser.cc @@ -1,6 +1,6 @@ /* PowerDNS Versatile Database Driven Nameserver - Copyright (C) 2005 - 2007 PowerDNS.COM BV + Copyright (C) 2005 - 2008 PowerDNS.COM BV This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as @@ -19,6 +19,7 @@ #include "dnsparser.hh" #include "dnswriter.hh" #include +#include using namespace boost; @@ -53,9 +54,9 @@ public: string tmp((char*)&*d_record.begin(), d_record.size()); vector parts; stringtok(parts, tmp); - if(parts.size()!=3) + if(parts.size()!=3 && !(parts.size()==2 && equals(parts[1],"0")) ) throw MOADNSException("Unknown record was stored incorrectly, need 3 fields, got "+lexical_cast(parts.size())+": "+tmp ); - const string& relevant=parts[2]; + const string& relevant=(parts.size() > 2) ? parts[2] : ""; unsigned int total=atoi(parts[1].c_str()); if(relevant.size()!=2*total) throw runtime_error("invalid unknown record");