This nice IMAP server authors could have violated (did not check correctly) the RFC that should state that multiple blanks in a reply are not allowed.
No matter if putting multiple blanks in an imap reply is or is not legal, I prefer to patch my code to have wmbiff working. My solution was to replace strncpy with a replacement that copies a single blank each time multiple blanks are found.
Having issues committing the single changed file (dockapps/wmbiff/wmbiff/tlsComm.c I add my patch here.
This nice IMAP server authors could have violated (did not check correctly) the RFC that should state that multiple blanks in a reply are not allowed.
No matter if putting multiple blanks in an imap reply is or is not legal, I prefer to patch my code to have wmbiff working. My solution was to replace strncpy with a replacement that copies a single blank each time multiple blanks are found.
Having issues committing the single changed file (dockapps/wmbiff/wmbiff/tlsComm.c I add my patch here.
---------------------------------------8<---------------------------------------------------------------------- From 1697c7f78874e66ac25f4249805f111fecc9ba18 Mon Sep 17 00:00:00 2001 Message-Id: 1697c7f78874e66ac25f4249805f111fecc9ba18.1679925131.git.saint@eng.it In-Reply-To: f2bf4066c333a526d2f87733edb342acde7e466d.1679925131.git.saint@eng.it References: f2bf4066c333a526d2f87733edb342acde7e466d.1679925131.git.saint@eng.it From: Gian Uberto Lauri saint@eng.it Date: Mon, 27 Mar 2023 15:40:56 +0200 Subject: [PATCH 2/2] #feature/handle_multiple_blanks - Handles wrong (multiple blanks) answer from Office365 IMAP server
Changes to be committed: modified: wmbiff/wmbiff/tlsComm.c
wmbiff/wmbiff/tlsComm.c | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-)
diff --git a/wmbiff/wmbiff/tlsComm.c b/wmbiff/wmbiff/tlsComm.c index 03b8009..fb4731a 100644 --- a/wmbiff/wmbiff/tlsComm.c +++ b/wmbiff/wmbiff/tlsComm.c @@ -159,6 +159,35 @@ static int wait_for_it(int sd, int timeoutseconds) return (FD_ISSET(sd, &readfds)); }
+/ exported for testing / +/* This version converts sequence of multiple blanks into a single
/ exported for testing / extern int getline_from_buffer(char readbuffer, char linebuffer, int linebuflen) @@ -184,7 +213,7 @@ getline_from_buffer(char readbuffer, char linebuffer, int linebuflen)
if (i != 0) { / copy a line into the linebuffer /
-------8<------------------------------------------------------------------------------------