Message contains NUL characters ...

Greg A. Woods woods at
Mon May 9 15:46:37 EDT 2005

[ On Monday, May 9, 2005 at 20:51:09 (+0200), John Fawcett wrote: ]
> Subject: Re: Message contains NUL characters ...
> as I understand it's the nuls in the header/body checks which
> are not supported, not the presence of a nul in the message which
> prevents header/body checks being applied.

No, it's the NUL in the _lines_ of message text which are passed
one-by-one by Postfix to the regex engine for matching.

Note that there is no NUL embedded in the regex itself -- just an ASCII
pattern that represents a NUL, like this:  /\x00/

(The only thing I'm not 100% sure about is whether Postfix treats the
NUL as if it were the end of a line -- i.e. I don't know if the text
after the NUL up to the next newline is passed as a separate line, or
whether it's completely ignored.  I.e. I'm not 100% sure of my claim
that Postfix header_checks and body_checks will not see text on a line
after a NUL byte.)

The right way to do the matching of course is to use buffers
(i.e. vectors or arrays of bytes), not C strings, when calling the regex

In Smail, for example, the entire RFC-822 message body is passed as one
big buffer to the PCRE engine for smail's equivalent to body_checks
matching, as is each entire RFC-822 header field (i.e. multi-line
headers are passed as one buffer, complete with all original folding and
indentation).  The buffers are not NUL terminated as they are in
Postfix, but instead their total length is specified and so PCRE can see
NULs within the text.

> I am actually looking at this too, but that will benefit only postfix
> users not all users of cyrus.

That's good -- that's the only right thing to do.

Cyrus isn't broken -- it's already doing the right thing.  Postfix is
what needs fixing.  Cyrus users who are using other MTAs are not having
this problem in the first place -- only postfix users are suffering.

						Greg A. Woods

H:+1 416 218-0098  W:+1 416 489-5852 x122  VE3TCP  RoboHack <woods at>
Planix, Inc. <woods at>          Secrets of the Weird <woods at>
Cyrus Home Page:
Cyrus Wiki/FAQ:
List Archives/Info:

More information about the Info-cyrus mailing list