Mailing List Archive

Segfault on AMD64
Hello,

i've found a little Problem with libspf2 1.2.5 on my Suse 9.3 AMD 64.
Configuring and compiling of libspf2 seems to be ok but make check will give
me many segfault's. Probably if an spfquery will give the result fail.
Also exim 4.53 witch needs this version 1.2.5 will segfault if the result of
an query is fail.

Then i've debugged spfquery_static witch caused the segfault in case of make
check i think.
I've found the problem in the function
SPF_i_set_smtp_comment(SPF_response_t *spf_response)

in src/libspf2/spf_interpret.c

There is an defintion for "int buflen"
and this variable buflen then will be used in calling the function
err = SPF_request_get_exp(spf_server, spf_request,
spf_response,spf_record, &buf, &buflen);

witch is defined in spf_get_exp.c.
SPF_server_get_default_explanation(SPF_server_t *spf_server,
SPF_request_t *spf_request,
SPF_response_t *spf_response,
char **bufp, size_t *buflenp)

The problemn is, that the last parameter of this function is defined as size_t
but will be called with an int from spf_interpret.c
On the AMD64 pointers are 8 bytes and size_t is also 8 bytes but int is 4 Byte
and so i get an value of 22984798340943ß03 or somethings else for buflen in
SPF_server_get_default_explanation witch then calls SPF_record_expand_data
with this value and ends up at memset( *bufp, '\0', *buflenp ); with the
segfault.

So i've changed the definition of buflen in
spf_interpret.c/SPF_i_set_smtp_comment to
size_t buflen;
and the problem was gone. No more segfaults.
I think this could be intresting to other ones who will also use libspf2 on
amd64


Sorry for my english but this is not my preferred language. Also i'm not at
c-programmer so if there is something wrong with my changes please correct
me.

Greetings
Carsten



-------
To unsubscribe, change your address, or temporarily deactivate your subscription,
please go to http://v2.listbox.com/member/?listname=spf-devel@v2.listbox.com