From 314bb17a6daab93133de942cabc86dffb2956ca4 Mon Sep 17 00:00:00 2001 From: deuce <> Date: Tue, 13 Mar 2018 00:41:34 +0000 Subject: [PATCH] Limit push size to 8k. Fixes issue in the IMAP server where ver large sends would cause MAC errors. --- src/sbbs3/js_socket.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/sbbs3/js_socket.c b/src/sbbs3/js_socket.c index 69755f4838..3b5e17dca4 100644 --- a/src/sbbs3/js_socket.c +++ b/src/sbbs3/js_socket.c @@ -154,7 +154,7 @@ static ptrdiff_t js_socket_recv(js_socket_private_t *p, void *buf, size_t len, i fd_set socket_set; struct timeval tv = {0, 0}; char *estr; - + if (len == 0) return total; if(p->session==-1) { @@ -201,7 +201,8 @@ static ptrdiff_t js_socket_sendsocket(js_socket_private_t *p, const void *msg, s if(p->session==-1) return sendsocket(p->sock, msg, len); do { - if((ret=cryptPushData(p->session, msg, len, &copied))==CRYPT_OK) { + // If we don't limit this, we occasionally get errors on large sends... + if((ret=cryptPushData(p->session, msg, len > 0x2000 ? 0x2000 : len, &copied))==CRYPT_OK) { p->unflushed += copied; if(flush) do_CryptFlush(p); -- GitLab