Re: OpenDKIM 2.5.1 Crashes On Certain Messages

From: John Merriam <john_at_johnmerriam.net>
Date: Sat, 31 Mar 2012 17:31:24 -0400

On 03/31/2012 03:50 PM, SM wrote:
> At 11:23 31-03-2012, John Merriam wrote:
>> Still shouldn't croak obviously. I would guess there is some sort of
>> problem with parsing malformed From headers when LocalADSP is enabled
>> in OpenDKIM.
>
> In some hemispheres, it's called a bug. :-)


I may be completely wrong, but reading the code, I think OpenDKIM is
exiting via the assert call on line 5293 in opendkim.c:

static int
dkimf_local_adsp(struct dkimf_config *conf, char *domain, dkim_policy_t
*pcode)
{
         assert(conf != NULL);
         assert(domain != NULL); <--- HERE, line 5293
         assert(pcode != NULL);


when called from opendkim.c line 13458.

Two lines above 13458 (line 13456) we are doing this:

domain = dkim_getdomain(dfc->mctx_dkimv);

Digging down through libopendkim it seems if there is no domain in the
 From header the end result of a call to dkim_getdomain() will be NULL.

Then on line 13458 we are doing this:

dkimf_local_adsp(conf, (char *) domain, &dfc->mctx_pcode)

In other words, sending a NULL for the domain variable to
dkimf_local_adsp() which then triggers the assert and program
termination. For this particular message anyway and probably any others
with no domain in the From header when LocalADSP is set in the .conf.

I am attaching a patch which should correct the program termination
problem. I haven't had time to test it yet. You may want to do
something different than what I did which is basically just a work around.

You may want to check what is going on near other calls to
dkim_getdomain() as well...

I will try to test it when I can and report back.

-- 
John Merriam



Received on Sat Mar 31 2012 - 21:31:36 PST

This archive was generated by hypermail 2.3.0 : Mon Oct 29 2012 - 23:20:38 PST