Message contains NUL characters ...

Andrew Morgan morgan at
Thu Apr 28 15:35:02 EDT 2005

On Thu, 28 Apr 2005, Amos wrote:

> Maybe *ideally* it needs to be fixed by the MTA. However, just casually 
> following this list and the postfix-users list, whenever the issue of NUL 
> characters have come up, it has always been centered around Cyrus. I know 
> that there are folks using Postfix with other IMAP servers, and never once 
> have I noticed this topic in relation to these systems. As best as I can 
> recall, it has always been in relation to Cyrus.
> So, my take on this is that while it may be *ideally* better dealt with by 
> the MTA, perhaps *practically* it is more productive to remedy the software 
> that is bitching the most about it. It certainly would cut down on the 
> frequency that this issue comes up on this list....

Maybe I need to read back in this thread to remember, but what was the 
suggested solution in Cyrus?

I think Cyrus is correct to bounce these messages back to the sender. 
Accepting them seems somewhat dangerous.  What happens when parts of Cyrus 
or the IMAP protocol see a NUL?  Can we be sure that a NUL character won't 
cause problems "downstream"?

A cursory look through rfc3501 shows:

4.3.1.  8-bit and Binary Strings

    8-bit textual and binary mail is supported through the use of a
    [MIME-IMB] content transfer encoding.  IMAP4rev1 implementations MAY
    transmit 8-bit or multi-octet characters in literals, but SHOULD do
    so only when the [CHARSET] is identified.

    Although a BINARY body encoding is defined, unencoded binary strings
    are not permitted.  A "binary string" is any string with NUL
    characters.  Implementations MUST encode binary data into a textual
    form, such as BASE64, before transmitting the data.  A string with an
    excessive amount of CTL characters MAY also be considered to be

9.      Formal Syntax


         (3) The ASCII NUL character, %x00, MUST NOT be used at any

It seems pretty clear that even if you accepted messages with NUL 
characters, you'd have to transform/strip that NUL anyways.

Food for thought.

Cyrus Home Page:
Cyrus Wiki/FAQ:
List Archives/Info:

More information about the Info-cyrus mailing list