From: Chris Hofstaedtler Date: Mon, 8 Jan 2018 15:16:57 +0000 (+0100) Subject: Do not pretty-print out-of-range RCodes X-Git-Tag: dnsdist-1.3.0~160^2~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=96529aa1b2776fd8d4d96612c89d883b51bdbbf9;p=pdns Do not pretty-print out-of-range RCodes --- diff --git a/pdns/dns.cc b/pdns/dns.cc index 71f2c0e76..5d4073564 100644 --- a/pdns/dns.cc +++ b/pdns/dns.cc @@ -46,7 +46,7 @@ std::vector RCode::rcodes_s = boost::assign::list_of ("Err#12") ("Err#13") ("Err#14") - ("Err#15") + ("Err#15") // Last non-extended RCode ("Bad OPT Version / TSIG Signature Failure") ("Key not recognized") ("Signature out of time window") @@ -58,13 +58,15 @@ std::vector RCode::rcodes_s = boost::assign::list_of ; std::string RCode::to_s(uint8_t rcode) { - if (rcode > RCode::rcodes_s.size()-1 ) - return std::string("Err#")+std::to_string(rcode); - return RCode::rcodes_s[rcode]; + if (rcode > 0xF) + return std::string("ErrOutOfRange"); + return ERCode::to_s(rcode); } std::string ERCode::to_s(uint8_t rcode) { - return RCode::to_s(rcode); + if (rcode > RCode::rcodes_s.size()-1) + return std::string("Err#")+std::to_string(rcode); + return RCode::rcodes_s[rcode]; } class BoundsCheckingPointer