nmh-workers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: (Not-so) hypothetical question: What to do about NULs?


From: Andy Bradford
Subject: Re: (Not-so) hypothetical question: What to do about NULs?
Date: 22 Feb 2023 17:10:28 -0700

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

[Prev in Thread] Current Thread [Next in Thread]