From 1cf238549b8a2626f537f00b215e75eb19621570 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Mon, 14 Dec 2009 20:02:14 +0300 Subject: [PATCH] * Fix issue with list concat --- perl/lib/Mail/Rspamd/Client.pm | 4 ++-- src/spf.c | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/perl/lib/Mail/Rspamd/Client.pm b/perl/lib/Mail/Rspamd/Client.pm index 32801b9ab..1fcaef130 100644 --- a/perl/lib/Mail/Rspamd/Client.pm +++ b/perl/lib/Mail/Rspamd/Client.pm @@ -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; } diff --git a/src/spf.c b/src/spf.c index 7cb5ffe93..662ae285b 100644 --- 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; -- 2.39.5