Skip to content

Commit f19ec78

Browse files
committed
Bugfix - buffer must always hold at least 'size' bytes
1 parent 7118544 commit f19ec78

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/main/java/org/apache/commons/codec/binary/BaseNCodec.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ public String encodeToString(final byte[] pArray) {
567567
*/
568568
protected byte[] ensureBufferSize(final int size, final Context context){
569569
if (context.buffer == null) {
570-
context.buffer = new byte[getDefaultBufferSize()];
570+
context.buffer = new byte[Math.max(size, getDefaultBufferSize())];
571571
context.pos = 0;
572572
context.readPos = 0;
573573

0 commit comments

Comments
 (0)