]> dgit.raspbian.org Git - dovecot.git/commit
[PATCH 09/14] lib-storage: Cap per-header size in index_mail_get_header_stream()
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Sun, 19 Apr 2026 15:28:16 +0000 (18:28 +0300)
committerNoah Meyerhans <noahm@debian.org>
Wed, 16 Sep 2026 19:06:35 +0000 (15:06 -0400)
commit9b1e29260ec699bcd408bc49ae79c126f9f994d3
tree61bbc01299ecd2a2283e3e2801437d08d99a0ddf
parentc4ad54206d2b72b274c64056c5882314cc8f3ee3
[PATCH 09/14] lib-storage: Cap per-header size in index_mail_get_header_stream()

Apply MESSAGE_HEADER_BLOCK_DEFAULT_MAX_SIZE (10 MB) to the header-filter
istream used for populating the header cache. A pathological single
header (for example a To: with millions of addresses) otherwise grows
mail->header_data and the cache write buffer in lockstep with the raw
header size, which can push the imap process over vsz_limit on FETCH
ENVELOPE / BODYSTRUCTURE.

On its own this change does not yet bound hdr->value delivery; that
requires the upcoming change to message_parse_header_next() to clamp
per-chunk value_len cumulatively. Setting the limit here now lets that
follow-up take effect without further touching this file.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Gbp-Pq: Name 0009-lib-storage-Cap-per-header-size-in-index_mail_get_he.patch
src/lib-storage/index/index-mail-headers.c