isync

mailbox synchronization program
git clone https://git.code.sf.net/p/isync/isync
Log | Files | Refs | README | LICENSE

commit 92921b1d3b7262eaa0fbb095cc714098b431c2f9
parent bc15e571b650270b87e9758916f93eab04992cef
Author: Oswald Buddenhagen <ossi@users.sf.net>
Date:   Wed, 24 Nov 2021 17:51:06 +0100

reject messages that grow too large due to conversion

that shouldn't really be a problem, as we have 2GB of headroom, and most
growth would happen when sending an all-newlines message from maildir to
imap (due to CR additions), which is mostly non-critical. but better
safe than sorry.

Diffstat:
Msrc/sync.c | 6++++++
1 file changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/sync.c b/src/sync.c @@ -494,6 +494,12 @@ copy_msg_convert( int in_cr, int out_cr, copy_vars_t *vars, int t ) } vars->data.len = in_len + extra; + if (vars->data.len > INT_MAX) { + warn( "Warning: message %u from %s is too big after conversion; skipping.\n", + vars->msg->uid, str_fn[1-t] ); + free( in_buf ); + return 0; + } char *out_buf = vars->data.data = nfmalloc( vars->data.len ); idx = 0; if (vars->srec) {