--- /Base64.java	2023-07-05 03:13:19.938025538 +0200
+++ /Codec-1/src/java/org/apache/commons/codec/binary/Base64.java	2023-07-05 03:13:19.942025539 +0200
@@ -591,7 +591,7 @@
         }
 
         int startDst = bitlen / 8 - len; // to pad w/ nulls as per spec
-        byte[] resizedBytes = new byte[bitlen / 8];
+byte[] resizedBytes = new byte[encodedIndex / 8];
 
         System.arraycopy(bigBytes, startSrc, resizedBytes, startDst, len);
 
