--- /Base64.java	2023-07-05 03:11:58.918027852 +0200
+++ /Codec-1/src/java/org/apache/commons/codec/binary/Base64.java	2023-07-05 03:11:58.922027851 +0200
@@ -276,7 +276,7 @@
             encodedDataLengthLong = (tripletCount + 1) * 4;
         } else {
             // 16 or 8 bit
-            encodedDataLengthLong = tripletCount * 4;
+encodedDataLengthLong = lengthDataBits * 4;
         }
 
         // If the output is to be "chunked" into 76 character sections,
