Author: Adam D. Barratt Date: To: Brian Kendig CC: Marc MERLIN, Exim-users, Philip Hazel Subject: Re: [Exim] Re: [SA-exim] local_scan is crashing (log_write crash)
On Thu, 2004-05-20 at 18:50, Brian Kendig wrote: > On May 20, 2004, at 11:54 AM, Adam D. Barratt wrote:
> > My immediate suspicion would be that you're corrupting the stack, hence
> > reversing the arguments working (also only using one argument, and
> > using constants).
> >
> > I don't have access to an OS X box to test, but the first thing I'd
> > look at is what sizeof(off_t) and sizeof(int) are equal to in that
> > environment. I'd put good money on them being different.
>
> Bingo!
> [...]
> sizeof(int) == 4
> sizeof(off_t) == 8
Yep, that's what I thought the problem was. The assumption that a file
offset will fit in 32 bits breaks on a number of systems, including BSDs
and (as you've spotted) OS X.
Changing the offending code to the following should fix the problem:
log_write(0, LOG_MAIN, "SA: Action: check skipped due to message size
(%.0f bytes) and SATruncBodyCond expanded to false (Message-Id: %s).
%s", fdsize-18, safemesgid, mailinfo);
with similar replacements for any other occasions on which printf(off_t)
occurs.