check-banned FAILED: Malformed UTF-8 character

Peter Dieth p.dieth at
Tue Apr 3 14:42:26 CEST 2012

Dear amavis users,

we are running postfix + amavisd-new 2.7.0 on RHEL3 (perl v5.8.0).

From time to time mails get stuck in the postfix queue
because of the following error

   451 4.5.0 Error in processing, id=02676-02, check-banned FAILED:
   Malformed UTF-8 character (unexpected continuation byte 0x81, with no
   preceding start byte) in substitution iterator at /usr/sbin/amavisd
   line 2874. (in reply to end of DATA command))

It looks like the substitution command in "sub sanitize_str"
does not handle all cases of input.

As work-around we put an eval around the command but this
seems very ugly because it heals the symptoms but does
not remove the root cause. :-)

    eval {
    $str =~ s/([^\040-\133\135-\176])/      # and \240-\376 ?
              exists($quote_controls_map{$1}) ?
$quote_controls_map{$1} :
                   sprintf(ord($1)>255 ? '\\x{%04x}' : '\\%03o',

Is there any other known solution beside upgrading the OS (+perl +...)
to get rid of the problem?

Best regards,

PS: We already set a non UTF8-locale (LANG = LC_ALL = C) in the 
init scripts of postfix & amavisd.

More information about the amavis-users mailing list