From 8001d09a9b418e83771813750532b0a29a89847f Mon Sep 17 00:00:00 2001 From: Matthias Andree Date: Thu, 26 Aug 2021 23:53:14 +0200 Subject: IMAP: fix base64 length calc. for AUTH=EXTERNAL to make code more correct or readable; to64frombits does not overflow its buffer --- base64.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'base64.c') 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) */ { -- cgit v1.2.3