aboutsummaryrefslogtreecommitdiffstats
path: root/base64.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 /base64.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 'base64.c')
-rw-r--r--base64.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/base64.c b/base64.c
index 9af84a48..b1351422 100644
--- a/base64.c
+++ b/base64.c
@@ -27,6 +27,11 @@ static const char base64val[] = {
};
#define DECODE64(c) (isascii((unsigned char)(c)) ? base64val[c] : BAD)
+unsigned len64frombits(unsigned inlen)
+{
+ return (inlen + 2)/3*4;
+}
+
int to64frombits(char *out, const void *in_, int inlen, size_t outlen)
/* raw bytes in quasi-big-endian order to base 64 string (NUL-terminated) */
{