[fetchmail]Re: fetchmail segfault on 'empty' mail

Matthias Andree fetchmail-devel@lists.berlios.de
Tue, 6 Dec 2005 12:50:26 +0100


[resending to the list, too, with more information on what I've tried to
reproduce]

Please take everything to the berlios.de lists (you'll need to
subscribe there) - we plan to leave the ccil.org lists since nobody has
administrative access to them any more.

On Mon, 05 Dec 2005, Daniel Drake wrote:

> Hi,
> 
> I noticed that my fetchmail was segfaulting at the very start of a 
> particular mail message, with this trace:
> 
> #0  0xb7e67423 in strlen () from /lib/tls/libc.so.6
> #1  0x0805cded in readheaders (sock=6, fetchlen=0, reallen=0, 
> ctl=0x808d2d8, num=2, suppress_readbody=0xbff7c835 "")
>     at transact.c:920
> #2  0x080597df in fetch_messages (mailserver_socket=6, ctl=0x808d2d8, 
> count=272, msgsizes=0xbff7c7f0, maxfetch=0,
>     fetches=0xbff7e8c0, dispatches=0xbff7e8bc, deletions=0xbff7e8cc) at 
> driver.c:614
> #3  0x0805ae82 in do_session (ctl=0x808d2d8, proto=0x8071da0, maxfetch=0) 
> at driver.c:1449
> #4  0x0805b39d in do_protocol (ctl=0x808d2d8, proto=0x8071da0) at 
> driver.c:1622
> #5  0x0804f81a in doPOP3 (ctl=0x808d2d8) at pop3.c:1215
> #6  0x08054c11 in query_host (ctl=0x808d2d8) at fetchmail.c:1373
> #7  0x08052c26 in main (argc=4, argv=0xbff80bd4) at fetchmail.c:646
> 
> It is downloading mail from POP3.

I seem to be unable to reproduce this. I've tried the POP3 modules of
Dovecot 0.99.14 and some older Courier-IMAP.

What upstream server software are you using,
who built your fetchmail version,
and what is your .fetchmailrc?

> --- fetchmail-6.2.5/transact.c.orig	2005-12-05 15:25:54.000000000 +0000
> +++ fetchmail-6.2.5/transact.c	2005-12-05 16:16:45.000000000 +0000
> @@ -511,7 +511,7 @@ int readheaders(int sock,
>  	    }
>  
>  	    /* check for end of headers */
> -	    if (end_of_header(line))
> +	    if (msgblk.headers && end_of_header(line))
>  	    {
>  		if (linelen != strlen (line))
>  		    has_nuls = TRUE;

What has "msgblk.headers" got to do with "line"? I'm not particular fond
of such skewed checks, they'll come back some day to bite us.

-- 
Matthias Andree