Fetchmail is occasionally core dumping when trying to download certain spam messages, preventing me from getting to the more important messages behind them (and making it hard to determine that they _are_ spam)

From my preliminary debugging, it appears that the program is getting bogged down in the following loop:

    /* The line may contain NUL characters. Find the last char to use
     * -- the real line termination is the sequence "\n\0".
     */
    last = buf + 1; /* last[-1] must be valid! */
    while ((last += strlen(last)) && (last[-1] != '\n'))
        last++;
in the stuffline function in sink.c because buf doesn't contain the '\n' that stuffline assumes it has.

The question I haven't tried to figure out yet, is which function is/should be responsible for making sure this doesn't happen.