Hi,

I'm currently trying to use mbsync with XOAUTH2 authentication (needed
for Office365 mailboxes) and I encounter "Fatal: buffer too small.
Please report a bug." error.

Debugging with GDB revealed that the access token used for the LOGIN
command does not fit into the imap_vprintf buffer, which is currently
1000 characters long. In my case, I needed the buffer to hold at least
2000 characters.

I see that in the current master, the size of the buffer can be
increased by defining QPRINTF_BUFF during compilation, but for the
latest released version 1.4.4, I'm using the following patch. To make
the size of the buffer more future-proof, I increase the buffer size to
4000 characters. Maybe, somebody will find it useful.

Best regards,
-Michal

>From e8a3a20aed135272a9ec0103f4055411c075f043 Mon Sep 17 00:00:00 2001
From: Michal Sojka <michal.so...@cvut.cz>
Date: Mon, 7 Nov 2022 00:07:22 +0100
Subject: [PATCH] Increase imap_vprintf buffer size
---
 src/drv_imap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/drv_imap.c b/src/drv_imap.c
index c5a7aed..7847192 100644
--- a/src/drv_imap.c
+++ b/src/drv_imap.c
@@ -528,7 +528,7 @@ imap_vprintf( const char *fmt, va_list ap )
        uint totlen = 0;
        const char *segs[MAX_SEGS];
        uint segls[MAX_SEGS];
-       char buf[1000];
+       char buf[4000];
 
        d = buf;
        ed = d + sizeof(buf);
-- 
2.38.1


_______________________________________________
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel

Reply via email to