From: Peter van Dijk Date: Mon, 13 May 2013 06:45:17 +0000 (+0200) Subject: do a better job at escaping TXT, fixes #795 X-Git-Tag: auth-3.3-rc1~66 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=837f4b49747bb14da1baa575956f5105b3759d4b;p=thirdparty%2Fpdns.git do a better job at escaping TXT, fixes #795 --- diff --git a/pdns/dnsparser.cc b/pdns/dnsparser.cc index a1e1315f7a..7889aa9599 100644 --- a/pdns/dnsparser.cc +++ b/pdns/dnsparser.cc @@ -392,10 +392,7 @@ static string txtEscape(const string &name) char ebuf[5]; for(string::const_iterator i=name.begin();i!=name.end();++i) { - if(*i=='\n') { // XXX FIXME this should do a way better job! - ret += "\\010"; - } - else if((unsigned char) *i > 127) { + if((unsigned char) *i > 127 || (unsigned char) *i < 32) { snprintf(ebuf, sizeof(ebuf), "\\%03u", (unsigned char)*i); ret += ebuf; }