From: Timo Sirainen Date: Tue, 28 May 2019 10:35:11 +0000 (+0300) Subject: lib: base64 - Change MAX_BASE64_DECODED_SIZE() to be more exact X-Git-Tag: 2.3.8~147 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f6c6fbe1ca16d23419bc08782dff34825dd8988b;p=thirdparty%2Fdovecot%2Fcore.git lib: base64 - Change MAX_BASE64_DECODED_SIZE() to be more exact If the input has only full base64 blocks (is divisible by 4), there's no need to add the extra +3. --- diff --git a/src/lib/base64.h b/src/lib/base64.h index 0576f62e67..b497926f7f 100644 --- a/src/lib/base64.h +++ b/src/lib/base64.h @@ -28,5 +28,5 @@ bool base64_is_valid_char(char c); ((((size) + 2) / 3) * 4) /* max. buffer size required for base64_decode() */ #define MAX_BASE64_DECODED_SIZE(size) \ - ((size) / 4 * 3 + 3) + (((size) + 3) / 4 * 3) #endif