Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#48 Wrong functionality using -d with wildcards

v0.6.0
closed-fixed
5
2008-03-13
2007-07-30
rhuizer
No

Hi,

I'm running dk-filter using domain wildcards, which results in erronic behaviour.

In mlfi_eoh() the domain is extracted in the following manner:

/* extract the sender's domain */
sm_strlcpy(addr, from->hdr_val, sizeof addr);
status = rfc2822_mailbox_split(addr, &p, &dfc->mctx_domain);
if (status != 0 || p == NULL || dfc->mctx_domain == NULL)

Here, addr is an array on the local stackframe, and mctx_domain will contain a pointer to frame local data after rfc2822_mailbox_split().

When wildcards aren't used, this pointer is later reassigned to domains[n], and this is not a problem, however, when wildcard expansion is used, mctx_domain will still refer to stack local data after the function finishes.
Afterwards, dfc->mctx_domain is referred to in mlfi_eom() when the actual signature header is added to the mail, including d=[stack garbage] instead of what one would like to see.

The obvious solution is to strdup() mctx_domain and free it up later, but I thought it best to leave the details of such a patch to you.

With kind regards,
-- Ronald Huizer

Discussion

    • assigned_to: nobody --> sm-msk
     
  • Logged In: YES
    user_id=1048957
    Originator: NO

    Fixed in 0.6.1, which should be released within the next week or so.

     
  • Logged In: YES
    user_id=1048957
    Originator: NO

    v1.0.0 released, containing this fix.

     
    • status: open --> closed-fixed