Re: libspf2 memory corruption (?)

Scott Kitterman <[email protected]> Mon, 10 Dec 2007 11:59:25 -0500
Newsgroups gmane.mail.spam.spf.devel
Organization Kitterman Technical Services
Message-ID <[email protected]>
On Monday 10 December 2007 11:50, Bas Verhoeven wrote:
> Hi,
>
> I am experiencing problems with libspf2. I have been trying various
> versions starting with libspf2 1.0.4, and so far every version I tried
> (up to the debian libspf 1.2.5.dfsg-4) is having the same problems.
>
> In this case I'm trying with libspf 1.2.5.dfsg-4 (debian).
>
> I have tried to contact the Debian maintainer for this package, but
> haven't received any reply. The RT bug thingie also seems to be broken,
> so I really hope some of you can help me out.
>
> I am using this library like this:
>
>   SPF_server_t *spf_server = SPF_server_new(SPF_DNS_CACHE, 0);
>   SPF_request_t *spf_request = SPF_request_new(spf_server);
>   SPF_response_t *spf_response = NULL;
>
> But as soon as I initialize the server, memory gets corrupted:
>
> [PC: 0xb7d478cc] (Thread 0) **FREE_NULL**
>
> Freeing null pointer.
>
> Stack trace where the error occurred:
>                        realloc()  (interface)
>       SPF_record_compile_macro()
>             SPF_record_compile()
>     SPF_server_set_localpolicy()
>                 SPF_server_new()
>                           main()  autoreply.c, 116
>
> **Memory corrupted.  Program may crash!!**
>
> The above dump is from the binary debian package, below is the dump from
> the (debian) source package:
>
> [spf_compile.c:107] (Thread 0) **FREE_NULL**
>
>  >>                 *datap = realloc(*datap, size);
>
> Freeing null pointer: *datap
>
> Stack trace where the error occurred:
>          SPF_c_ensure_capacity()  spf_compile.c, 107
>                 SPF_c_mech_add()  spf_compile.c, 831
>             SPF_record_compile()  spf_compile.c, 1260
>     SPF_server_set_localpolicy()  spf_server.c, 226
>                 SPF_server_new()  spf_server.c, 127
>                           main()  autoreply.c, 116
>
> **Memory corrupted.  Program may crash!!**
>
> Most of the times my program survives, but sometimes my program does
> indeed crash after it does some memory operations, so I have the feeling
> my code checker (Insure++) is right and libspf2 is indeed trying to free
> a null pointer.
>
> I was wondering if I am doing something wrong. If not, is this a known
> bug, and if so is there a fix available?
>
> Please let me know if you need any additional information.
>
The architecture and release you are using would be useful.  Think of the 
stuff that reportbug appends to a normal Debian bug report.

The libspf2 maintainer does respond to bugs, so since you're using the Debian 
package, I'd suggest filing a bug in the Debian BTS.

Scott K

-------------------------------------------
Sender Policy Framework: http://www.openspf.org
Archives: http://v2.listbox.com/member/archive/1007/=now
RSS Feed: http://v2.listbox.com/member/archive/rss/1007/
Modify Your Subscription: http://v2.listbox.com/member/?member_id=6959932&id_secret=74247570-8b223c
Powered by Listbox: http://www.listbox.com