Subject: | handling of empty (rdlen=0) TXT RR |
Hi,
(
$ uname -a; perl -v
Darwin roy-arends-computer.local 8.6.1 Darwin Kernel Version 8.6.1: Tue Mar 7 16:55:45
PST 2006; root:xnu-792.9.22.obj~1/RELEASE_I386 i386 i386
This is perl, v5.8.6 built for darwin-thread-multi-2level
)
The following proof of concept code shows and error in parsing TXT records:
use Net::DNS;
((new Net::DNS::Resolver(nameservers => ['62.181.128.1']))->send
("version.bind","TXT","CH"))->print;
The error is as follows:
perl -w poc.pl
Use of uninitialized value in substitution (s///) at /System/Library/Perl/5.8.6/Text/
ParseWords.pm line 16.
Use of uninitialized value in length at /System/Library/Perl/5.8.6/Text/ParseWords.pm line
29.
;; Answer received from 62.181.128.1 (54 bytes)
;;
;; HEADER SECTION
;; id = 36679
;; qr = 1 opcode = QUERY aa = 1 tc = 0 rd = 1
;; ra = 1 ad = 0 cd = 0 rcode = NOERROR
;; qdcount = 1 ancount = 1 nscount = 0 arcount = 0
;; QUESTION SECTION (1 record)
;; version.bind. CH TXT
;; ANSWER SECTION (1 record)
VERSION.BIND. 0 CH TXT ; no data
;; AUTHORITY SECTION (0 records)
;; ADDITIONAL SECTION (0 records)
Note, the IP address responds with a TXT record in the CH class for name version.bind, where
RDLEN=0. This is illegal protocol-wise but should not cause Net::DNS::RR::TXT to barf.
Here's a patch:
--- TXT.pm 2006-04-24 08:50:56.000000000 +0200
+++ TXT.pm 2006-04-24 08:51:37.000000000 +0200
@@ -64,7 +64,7 @@
sub _build_char_str_list {
my ($self, $rdata_string) = @_;
- my @words = shellwords($rdata_string);
+ my @words = shellwords($rdata_string) if $rdata_string;
$self->{'char_str_list'} = [];
Regards,
Roy Arends