On Tue, Mar 19, 2019 at 06:08:27PM +0000, Thorben Thuermer wrote:

> > /etc/postfix/main.cf has:
> > header_size_limit = 4096000
> > message_size_limit = 0
> > 
> > I found the responsible code in postfix-3.4.1/src/smtpd/smtpd.c 
> > commenting out that check also fixes the issue.
> > 
> >     /* Block too large chunks. */
> >     if (state->act_size > var_message_limit - chunk_size) {
> 
> after some more reading of code,
> it turns out that this usage of `var_message_limit` is missing the check
> of `var_message_limit > 0` that in other places enables `0` to mean
> "no limit", and thus it enforces a limit of 0 with my config :(

Correct.  The code should read:

--- src/smtpd/smtpd.c
+++ src/smtpd/smtpd.c
@@ -3878,7 +3878,8 @@ static int bdat_cmd(SMTPD_STATE *state, int argc, 
SMTPD_TOKEN *argv)
        }
     }
     /* Block too large chunks. */
-    if (state->act_size > var_message_limit - chunk_size) {
+    if (var_message_limit > 0
+       && state->act_size > var_message_limit - chunk_size) {
        state->error_mask |= MAIL_ERROR_POLICY;
        msg_warn("%s: BDAT request from %s exceeds message size limit",
                 state->queue_id ? state->queue_id : "NOQUEUE",

-- 
        Viktor.

Reply via email to