Yahoo Groups archive

Milter-greylist

Index last updated: 2026-04-28 23:32 UTC

Message

Re: Milter Greylist crashes with libspf2

2008-03-15 by Jim Hermann

--- In milter-greylist@yahoogroups.com, "Johann E. Klasek" 
<johann@...> wrote:
>
> > > If this is not related to a the 64bit issue, I suggest to check 
the
> > > res_ninit-patch anyway.
> > 
> > Did you send these patches upstream?
> 
> Sorry, not yet reported to the spf2 developers.
> (just wondering about nothing happened since 1.2.5 so no one
> else seems to report bugs or improvements?)
> Will do it next (lost this on my todo list ;) ).

There are a number of known patches for libspf2-1.25

-rw-r--r--   1 root root  440 Feb 12  2007 libspf2-1.2.5-64bit.patch
-rw-r--r--   1 root root  337 Feb 12  2007 libspf2-1.2.5-bogus-
header.patch
-rw-r--r--   1 root root  40K Sep  5  2007 libspf2_1.2.5.dfsg-4.diff
-rw-r--r--   1 root root 8.5K Oct 22 10:30 libspf2-1.2.5-malloc.patch
-rw-r--r--   1 root root  900 Oct 19 18:35 libspf2-1.2.5-
res_ninit.patch

I had to collect them from various locations.  The spf2 developers 
are not interested in releasing a new version, just patches.

Here are a couple of pertinent ones:

*** libspf2-1.2.5/src/libspf2/spf_dns_resolv.c  Sat Feb 19 03:38:12 
2005
--- libspf2-1.2.5/src/libspf2/spf_dns_resolv.c  Wed Jun 20 15:15:26 
2007
***************
*** 144,151 ****
--- 144,163 ----
        if (res_spec == NULL) {
                res_state = (struct __res_state *)
                                                malloc(sizeof(struct 
__res_state));
+               if (res_state == NULL) {
+                       SPF_error("Failed to aquire res_state 
memory");
+                       return NULL;
+               }
+               /* Always initialize to zero, some resolver libary may
+                * try to expect an old state which will then used
+                * to cleanup from this previous state - if this is 
garbage
+                * the resolver library could raise a fault after 
some time ...
+                */
+               memset((void *)res_state, 0, sizeof(struct 
__res_state));
+
                if (res_ninit(res_state) != 0) {
                        SPF_error("Failed to call res_ninit()");
+                       return NULL;
                }
                pthread_setspecific(res_state_key, (void *)res_state);
        }


--- libspf2-1.2.5/src/libspf2/spf_interpret.c   2005-02-22 
03:41:27.000000000 +0000
+++ libspf2-1.2.5/src/libspf2/spf_interpret.c   2007-02-12 
08:02:20.000000000 +0000
@@ -48,9 +48,9 @@
        SPF_request_t   *spf_request;
        SPF_record_t    *spf_record;
        SPF_errcode_t    err;
-       char                    *buf;
-       int                              buflen;
-       int                              len;
+       char            *buf;
+       size_t           buflen;
+       size_t           len;

        SPF_ASSERT_NOTNULL(spf_response);
        spf_request = spf_response->spf_request;


Jim

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.