From c1ba555553fc4ef77a9a14bf89de867fbf3c7f55 Mon Sep 17 00:00:00 2001 From: md_5 Date: Mon, 18 Nov 2013 07:18:23 +1100 Subject: [PATCH] Hopefully fix native cipher segfault --- native/src/main/java/net/md_5/bungee/NativeCipher.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/native/src/main/java/net/md_5/bungee/NativeCipher.java b/native/src/main/java/net/md_5/bungee/NativeCipher.java index 41d2d03a..8aa90e9e 100644 --- a/native/src/main/java/net/md_5/bungee/NativeCipher.java +++ b/native/src/main/java/net/md_5/bungee/NativeCipher.java @@ -88,7 +88,7 @@ public class NativeCipher implements BungeeCipher // It is important to note that in AES CFB-8 mode, the number of read bytes, is the number of outputted bytes if ( out.writableBytes() < length ) { - out.capacity( length ); + out.capacity( out.writerIndex() + length ); } // Cipher the bytes nativeCipher.cipher( forEncryption, pointer, iv, in.memoryAddress() + in.readerIndex(), out.memoryAddress() + out.writerIndex(), length );