Thus said Ken Hornstein on Tue, 21 Feb 2023 21:29:16 -0500:

> So you're told  "I am sending this many bytes  exactly", and you don't
> have to  deal with "lines", so  the implementations I've seen  tend to
> call read() (or  the equivalent) until they get the  correct number of
> bytes, and  because you're  not dealing with  "lines" you  don't treat
> them as C strings.

While POP's LIST does actually include the size of the message in bytes,
that's prior  to any  CRLF mangling  that happens so  it cannot  be used
reliably as a method for determining when to stop reading. Unfortunate.

I notice however,  that some components of my  email infrastructure pass
NULs through without problems and some do not. qmail successfully queued
a message with  a NUL in both  the header and the body,  but other parts
(e.g. recipient validation tools) did not fare as well, and of course we
knew that inc would truncate (and it did because the lines with NUL were
truncated).

I suspect that qmail worked for the most part because of stralloc:

http://cr.yp.to/lib/stralloc.html

Andy


Reply via email to