]> source.dussan.org Git - rspamd.git/commitdiff
* Fix issue with list concat
authorVsevolod Stakhov <vsevolod@rambler-co.ru>
Mon, 14 Dec 2009 17:02:14 +0000 (20:02 +0300)
committerVsevolod Stakhov <vsevolod@rambler-co.ru>
Mon, 14 Dec 2009 17:02:14 +0000 (20:02 +0300)
perl/lib/Mail/Rspamd/Client.pm
src/spf.c

index 32801b9abb27b4de670ea34eb91c8216c3a5d0a8..1fcaef1301ba6ba7a47d86ded1fd042ab69ba05a 100644 (file)
@@ -168,7 +168,7 @@ sub check {
   $self->{resp_code} = $resp_code;
   $self->{resp_msg} = $resp_msg;
 
-  return undef unless ($resp_code == 0);
+  return undef unless (defined($resp_code) && $resp_code == 0);
 
   my $cur_metric;
   my @lines = split (/^/, $in);
@@ -297,7 +297,7 @@ sub ping {
   return undef unless $line;
 
   my ($version, $resp_code, $resp_msg) = $self->_parse_response_line($line);
-  return 0 unless ($resp_msg eq 'PONG');
+  return 0 unless (defined($resp_msg) && $resp_msg eq 'PONG');
 
   return 1;
 }
index 7cb5ffe93802a533c8d7dc0c3c745b502d279c29..662ae285b59613761804ba31e4a7703e3fecf370 100644 (file)
--- a/src/spf.c
+++ b/src/spf.c
@@ -285,8 +285,12 @@ spf_record_dns_callback (int result, char type, int count, int ttl, void *addres
                                                                        /* Insert new list in place of include element */
                                                                        last = g_list_last (cb->rec->addrs);
 
-                                                                       elt->prev->next = cb->rec->addrs;
-                                                                       elt->next->prev = last;
+                                                                       if (elt->prev) {
+                                                                               elt->prev->next = cb->rec->addrs;
+                                                                       }
+                                                                       if (elt->next) {
+                                                                               elt->next->prev = last;
+                                                                       }
 
                                                                        cb->rec->addrs->prev = elt->prev;
                                                                        last->next = elt->next;