[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: inc and non-compliant long lines redux
From: |
Ken Hornstein |
Subject: |
Re: inc and non-compliant long lines redux |
Date: |
Wed, 16 Nov 2022 13:45:07 -0500 |
Following up to myself ...
Since Ralph mentioned fetchmail, I was curious what it does when confronted
with a huge-assed line. Here's what I found in transact.c:
/*
* Try to gracefully handle the case where the length of a
* line exceeds MSGBUFSIZE.
*/
if (n && buf[n-1] != '\n')
{
rline = (char *) realloc(line, linelen + 1);
if (rline == NULL)
{
free (line);
return(PS_IOERR);
}
line = rline;
memcpy(line + linelen - n, buf, n);
line[linelen] = '\0';
ch = ' '; /* So the next iteration starts */
continue;
}
Which ... is a little confusing in the overall loop. But ... the way
I read it is that "line" is realloc()d to be larger, existing data is copied
into "line" and then it keeps going. So with Andy's email, he'd end up
with an 11MB buffer being allocated. I don't QUITE think that is required
(see previous emails) and it's entirely possible I am reading the overall
loop wrong. But it doesn't just give up, that's for sure; it deals.
As an aside, fetchmail uncerimoniously smashes all NULs that it finds.
Seems like a reasonable policy to me.
--Ken
- Re: inc and non-compliant long lines redux, (continued)
- Re: inc and non-compliant long lines redux, Ken Hornstein, 2022/11/14
- Re: inc and non-compliant long lines redux, Andy Bradford, 2022/11/14
- Re: inc and non-compliant long lines redux, Ralph Corderoy, 2022/11/15
- Re: inc and non-compliant long lines redux, Ken Hornstein, 2022/11/15
- Re: inc and non-compliant long lines redux, Andy Bradford, 2022/11/16
- Message not available
- Re: inc and non-compliant long lines redux, Ken Hornstein, 2022/11/16
- Re: inc and non-compliant long lines redux, Andy Bradford, 2022/11/16
- Re: inc and non-compliant long lines redux, Ken Hornstein, 2022/11/16
- Re: inc and non-compliant long lines redux, Andy Bradford, 2022/11/16
- Message not available
- Re: inc and non-compliant long lines redux, Ken Hornstein, 2022/11/16
- Re: inc and non-compliant long lines redux,
Ken Hornstein <=
- Re: inc and non-compliant long lines redux, Andy Bradford, 2022/11/21
- Message not available
- Re: inc and non-compliant long lines redux, Ken Hornstein, 2022/11/21
- Re: inc and non-compliant long lines redux, Andy Bradford, 2022/11/21
- Re: inc and non-compliant long lines redux, Andy Bradford, 2022/11/22
- Re: inc and non-compliant long lines redux, David Levine, 2022/11/27
- Re: inc and non-compliant long lines redux, Andy Bradford, 2022/11/29
Re: inc and non-compliant long lines redux, Andy Bradford, 2022/11/15