aboutsummaryrefslogtreecommitdiffstats
path: root/imap.c
diff options
context:
space:
mode:
authorMatthias Andree <matthias.andree@gmx.de>2021-08-26 23:53:14 +0200
committerMatthias Andree <matthias.andree@gmx.de>2021-08-26 23:53:14 +0200
commit8001d09a9b418e83771813750532b0a29a89847f (patch)
treed660b22fc0e8681ad8ef9908b71d0de8b44cfe1f /imap.c
parent84580ab863845586828269ebc7c3d0ad9376b3e3 (diff)
downloadfetchmail-8001d09a9b418e83771813750532b0a29a89847f.tar.gz
fetchmail-8001d09a9b418e83771813750532b0a29a89847f.tar.bz2
fetchmail-8001d09a9b418e83771813750532b0a29a89847f.zip
IMAP: fix base64 length calc. for AUTH=EXTERNAL
to make code more correct or readable; to64frombits does not overflow its buffer
Diffstat (limited to 'imap.c')
-rw-r--r--imap.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/imap.c b/imap.c
index d441ced8..f0d9ac95 100644
--- a/imap.c
+++ b/imap.c
@@ -398,7 +398,7 @@ static int do_auth_external (int sock, const char *command, const char *name)
if (name && name[0])
{
size_t len = strlen(name);
- if ((len / 3) + ((len % 3) ? 4 : 0) < sizeof(buf))
+ if (len64frombits(len) + 1 <= sizeof(buf)) /* +1: need to fit \0 byte */
to64frombits (buf, name, strlen(name), sizeof buf);
else
return PS_AUTHFAIL; /* buffer too small. */