From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Subject: [PATCH] Fix CVE-2026-33606 Upstream commits: dsync: Avoid potentially excessive data stack growth for mailbox attribute sending https://github.com/dovecot/core/commit/116bab8d7e4acedae628cc88772049bc08a36047 dsync: Fix escaping mail or attribute value that begins with a "." line https://github.com/dovecot/core/commit/3f73c11d0ebcfebbda0225699f30513efd8c77f4 Taken from the Debian bookworm security update (dovecot 1:2.3.19.1+dfsg1-2.1+deb12u7), which carries these fixes for 2.3, and applied to 2.3.21.1. --- a/src/doveadm/dsync/dsync-ibc-stream.c +++ b/src/doveadm/dsync/dsync-ibc-stream.c @@ -1502,12 +1502,12 @@ dsync_ibc_stream_send_mailbox_attribute( { struct dsync_ibc_stream *ibc = (struct dsync_ibc_stream *)_ibc; struct dsync_serializer_encoder *encoder; - string_t *str = t_str_new(128); char type[2]; if (ibc->minor_version < DSYNC_PROTOCOL_MINOR_HAVE_ATTRIBUTES) return; + string_t *str = str_new(default_pool, 128); str_append_c(str, items[ITEM_MAILBOX_ATTRIBUTE].chr); encoder = dsync_ibc_send_encode_begin(ibc, ITEM_MAILBOX_ATTRIBUTE); @@ -1543,11 +1543,12 @@ dsync_ibc_stream_send_mailbox_attribute( dsync_ibc_stream_send_string(ibc, str); if (attr->value_stream != NULL) { - ibc->value_output_last = '\0'; + ibc->value_output_last = '\n'; ibc->value_output = attr->value_stream; i_stream_ref(ibc->value_output); (void)dsync_ibc_stream_send_value_stream(ibc); } + str_free(&str); } static enum dsync_ibc_recv_ret @@ -1920,7 +1921,7 @@ dsync_ibc_stream_send_mail(struct dsync_ dsync_ibc_stream_send_string(ibc, str); if (mail->input != NULL) { - ibc->value_output_last = '\0'; + ibc->value_output_last = '\n'; ibc->value_output = mail->input; i_stream_ref(ibc->value_output); (void)dsync_ibc_stream_send_value_stream(ibc);