]> git.ipfire.org Git - thirdparty/dovecot/core.git/commit
lib-mail: ostream-dot - Fix potential assert-crash when parent stream buffer gets...
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Sat, 15 Dec 2018 14:24:42 +0000 (16:24 +0200)
committerTimo Sirainen <timo.sirainen@open-xchange.com>
Fri, 15 Feb 2019 12:47:37 +0000 (12:47 +0000)
commit3df4e47db28f06c983bfe7197e151d985235d3d3
tree56fa6b5643001b7043b78933d3e6eaae98822a20
parent848d08733cdfc4fefdf8d70dc8920d4391bb1bb7
lib-mail: ostream-dot - Fix potential assert-crash when parent stream buffer gets full

If max_bytes=1, the (max_bytes-2) calculation brings it to (size_t)-1. This
causes too much data to be sent to the parent stream, which then returns a
partial write and causes an assert-crash.

The final chunk calculation doesn't need the -2 check, because additional
bytes aren't inserted at that point.

Fixes:
Panic: file ostream-dot.c: line 208 (o_stream_dot_sendv): assertion failed: ((size_t)ret == sent + added)
src/lib-mail/ostream-dot.c