From 466d06216dbda95190d32b88076242814b51e4b2 Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Sun, 30 Dec 2018 11:08:13 -0500 Subject: [PATCH] Fix minor bug in JavaVelocityCipher --- .../natives/encryption/JavaVelocityCipher.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/native/src/main/java/com/velocitypowered/natives/encryption/JavaVelocityCipher.java b/native/src/main/java/com/velocitypowered/natives/encryption/JavaVelocityCipher.java index 814a3ce87..c7a14815e 100644 --- a/native/src/main/java/com/velocitypowered/natives/encryption/JavaVelocityCipher.java +++ b/native/src/main/java/com/velocitypowered/natives/encryption/JavaVelocityCipher.java @@ -51,8 +51,9 @@ public class JavaVelocityCipher implements VelocityCipher { } else { // If the destination we write to is an array, we can use the backing array directly. destination.ensureWritable(outputSize); - destination.writerIndex(cipher.update(asHeapBuf.array(), asHeapBuf.arrayOffset(), inBytes, - destination.array(), destination.arrayOffset())); + int produced = cipher.update(asHeapBuf.array(), asHeapBuf.arrayOffset(), inBytes, + destination.array(), destination.arrayOffset()); + destination.writerIndex(destination.writerIndex() + produced); } }