[prev in list] [next in list] [prev in thread] [next in thread] 

List:       fetchmail-friends
Subject:    Re: header line termination Re: [fetchmail] bug in 6.2.0
From:       Brian Sammon <brians+ () cs ! cmu ! edu>
Date:       2003-03-27 18:32:40
[Download RAW message or body]

This is a multipart MIME message.


> > Fetchmail is occasionally core dumping when trying to download certain 
> > spam messages, preventing me from getting to the more important messag 
> > behind them (and making it hard to determine that they _are_ spam)
<snip>
> I think I've traced the problem to somewhere inside the readheaders() 
> function
> in transact.c
> I'm looking at the function, and I see this big loop where it gets a lin 
> from somewhere, does some processing on it, and then appends it to 
> msgblk.headers.
> Right now, my thinking is that this line is supposed to be terminated by 
> "\n\0" before being appended to msgblk.headers, but that isn't happening 
> for some reason.

Attached is the patch I've created.  This is an intermittent,
unreproducable problem, but the patch has worked on two occasions when
vanilla Fetchmail 6.2.0 wouldn't work.  I suspect someone will want to
clean it up or find a better way of fixing the problem before accepting
the patch.



["fetchmail-6.2.0-patch" (text/plain)]

diff -cPr fetchmail-6.2.0/transact.c fetchmail-6.2.0-new/transact.c
*** fetchmail-6.2.0/transact.c	Mon Nov 25 23:04:56 2002
--- fetchmail-6.2.0-new/transact.c	Tue Mar 25 18:50:59 2003
***************
*** 687,692 ****
--- 687,706 ----
  	    }
  	}
  
+ 	if (linelen != strlen(line))
+ 	{
+ 	    printf("Warning: linelen not equal to strlen(line)\n");
+ 	    printf("This probably means there was a null in the line\n");
+ 	    printf("Everything (in this line) after the null is ignored\n");
+ 	}
+ 
+ 	if (line[strlen(line)-1] != '\n')
+ 	{
+ 	  printf("line is not terminated by \\n\n");
+ 	  printf("This shouldn't happen.  I'll try to fix it\n");
+ 	  line[strlen(line)-1] = '\n';
+ 	}
+ 
  	if (!msgblk.headers)
  	{
  	    oldlen = strlen(line);


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic