You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by qu...@apache.org on 2004/09/21 07:56:39 UTC

svn commit: rev 46960 - spamassassin/branches/3.0/lib/Mail/SpamAssassin

Author: quinlan
Date: Mon Sep 20 22:56:38 2004
New Revision: 46960

Modified:
   spamassassin/branches/3.0/lib/Mail/SpamAssassin/Dns.pm
Log:
bug 3794: add some defined() checks for incomplete DNS responses


Modified: spamassassin/branches/3.0/lib/Mail/SpamAssassin/Dns.pm
==============================================================================
--- spamassassin/branches/3.0/lib/Mail/SpamAssassin/Dns.pm	(original)
+++ spamassassin/branches/3.0/lib/Mail/SpamAssassin/Dns.pm	Mon Sep 20 22:56:38 2004
@@ -185,10 +185,13 @@
 
   my $packet = $self->{res}->bgread($query->[BGSOCK]);
   undef $query->[BGSOCK];
-
-  return if !defined $packet;
+  return unless (defined $packet &&
+		 defined $packet->header &&
+		 defined $packet->question &&
+		 defined $packet->answer);
 
   my $question = ($packet->question)[0];
+  return if !defined $question;
 
   # NO_DNS_FOR_FROM
   if ($self->{sender_host} &&
@@ -203,6 +206,7 @@
   }
   # DNSBL tests are here
   foreach my $answer ($packet->answer) {
+    next if !defined $answer;
     # track all responses
     $self->dnsbl_uri($question, $answer);
     # TODO: there are some CNAME returns that might be useful