Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: alex [...] gt.net
Cc:
AdminCc:

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



Subject: Net::DNS::Nameserver dies on invalid packets
Using Net::DNS::Nameserver version 835 (from Net::DNS 0.66), if you send an invalid packet to it using: use IO::Socket::INET; my $sock = new IO::Socket::INET( PeerAddr => $dns_server, PeerPort => 53, Proto => 'udp', Timeout => 1 ); print $sock "foo"; the nameserver dies with: Can't call method "additional" on an undefined value at /usr/local/lib/perl/5.8.8/Net/DNS/Nameserver.pm line 387. A fix is below: @@ -366,9 +366,11 @@ peerport => $sock->peerport }; my $reply = $self->make_reply($query, $peerhost, $conn) || return; - my $max_len = $self->max_udp_len($query); - print "Maximum reply length as advertosed in EDNS from $peerhost:$peerport: $max_len\n" if $self->{"Verbose"}; - $reply->truncate($max_len) if $self->{Truncate}; + if ($query) { + my $max_len = $self->max_udp_len($query); + print "Maximum reply length as advertised in EDNS from $peerhost:$peerport: $max_len\n" if $self->{"Verbose"}; + $reply->truncate($max_len) if $self->{Truncate}; + } local $| = 1 if $self->{"Verbose"}; print "Writing response - " if $self->{"Verbose"}; The problem is calling $self->max_udp_len($query) when $query may be undef if it's an invalid packet. Marked as "critical" as you can easily DOS anything using Net::DNS::Nameserver.
Hi Alex, This issue has recently been resolved in trunk (see also RT#67133: https://rt.cpan.org/Ticket/Display.html?id=67133 ). Best regards, Willem