Fix array out of bound exception (#12889)

Signed-off-by: Mark Herwege <mark.herwege@telenet.be>
This commit is contained in:
Mark Herwege
2022-06-06 11:38:50 +02:00
committed by GitHub
parent 1e864d444b
commit 654fa3e9ed

View File

@@ -48,7 +48,7 @@ public final class ElroConnectsUtil {
byte[] bytes = input.getBytes(StandardCharsets.UTF_8);
String content = "@".repeat((length > bytes.length) ? (length - bytes.length) : 0)
+ new String(bytes, StandardCharsets.UTF_8);
bytes = Arrays.copyOf(content.getBytes(StandardCharsets.UTF_8), length);
bytes = Arrays.copyOf(content.getBytes(StandardCharsets.UTF_8), length + 1);
bytes[length] = (byte) "$".charAt(0);
return HexUtils.bytesToHex(bytes);
}