Skip Menu |

This queue is for tickets about the Net-DNS CPAN distribution.

Report information
The Basics
Id: 67133
Status: resolved
Priority: 0/
Queue: Net-DNS

People
Owner: Nobody in particular
Requestors: JNLIN [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.66
Fixed in: (no value)



Subject: Net::DNS::Nameserver exits unexpectedly
Should check if $query is null in sub max_udp_len(). Please see the attachment file.
Subject: Nameserver.pm.patch.txt
--- /usr/local/lib/perl5/site_perl/5.10.1/mach/Net/DNS/Nameserver.pm 2009-12-30 19:01:39.000000000 +0800 +++ Nameserver.pm 2011-04-01 11:21:50.158555000 +0800 @@ -384,6 +384,8 @@ sub max_udp_len { my ($self, $query) = @_; + return 512 unless $query; + for my $rr ($query->additional) { return $rr->size if $rr->type eq 'OPT'; }
Hi Jui-Nan Lin, The only place max_udp_len is used, is from udp_connection. If $query is not defined (when a parse error occurred), the nameserver should not even try to produce an answer. Therefor I've committed the change below to trunk in stead. Best regards, Willem Index: lib/Net/DNS/Nameserver.pm =================================================================== --- lib/Net/DNS/Nameserver.pm (revision 883) +++ lib/Net/DNS/Nameserver.pm (working copy) @@ -366,7 +366,11 @@ print "UDP connection from $peerhost:$peerport to $sockhost\n" if $self->{"Verbose"}; - my $query = Net::DNS::Packet->new(\$buf); + my ($query, $err) = Net::DNS::Packet->new(\$buf, $self->{"Verbose"}); + if (!defined($query)) { + print "Error interpreting query: $err\n" if $self->{"Verbose"}; + return; + } my $conn = { sockhost => $sock->sockhost, sockport => $sock->sockport, On Thu Mar 31 23:28:36 2011, JNLIN wrote: Show quoted text
> Should check if $query is null in sub max_udp_len(). > Please see the attachment file.