]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
properly convey empty TXT strings (why??) through the recursor, closing ticket 178
authorBert Hubert <bert.hubert@netherlabs.nl>
Sat, 22 Mar 2008 16:03:15 +0000 (16:03 +0000)
committerBert Hubert <bert.hubert@netherlabs.nl>
Sat, 22 Mar 2008 16:03:15 +0000 (16:03 +0000)
git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@1166 d19b8d6e-7fed-0310-83ef-9ca221ded41b

pdns/dnsparser.cc

index 17372fee0b5b03bf46d4e0b46068676d93a0fe69..00c4f22fce0a7f8e1f37c0e28b9e9df65c7bc2c2 100644 (file)
@@ -400,9 +400,10 @@ string PacketReader::getText(bool multi)
     unsigned char labellen=d_content.at(d_pos++);
     
     ret.append(1,'"');
-    string val(&d_content.at(d_pos), &d_content.at(d_pos+labellen-1)+1);
-    
-    ret.append(txtEscape(val)); // the end is one beyond the packet
+    if(labellen) { // no need to do anything for an empty string
+      string val(&d_content.at(d_pos), &d_content.at(d_pos+labellen-1)+1);
+      ret.append(txtEscape(val)); // the end is one beyond the packet
+    }
     ret.append(1,'"');
     d_pos+=labellen;
     if(!multi)