From c1c48f19fca6432aeba9eedc46e9b06669b7e23f Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Tue, 28 May 2019 13:35:11 +0300 Subject: [PATCH] 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. --- src/lib/base64.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 -- 2.47.3