mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-25 14:55:55 +01:00
Fix array out of bound exception (#12889)
Signed-off-by: Mark Herwege <mark.herwege@telenet.be>
This commit is contained in:
parent
1e864d444b
commit
654fa3e9ed
@ -48,7 +48,7 @@ public final class ElroConnectsUtil {
|
|||||||
byte[] bytes = input.getBytes(StandardCharsets.UTF_8);
|
byte[] bytes = input.getBytes(StandardCharsets.UTF_8);
|
||||||
String content = "@".repeat((length > bytes.length) ? (length - bytes.length) : 0)
|
String content = "@".repeat((length > bytes.length) ? (length - bytes.length) : 0)
|
||||||
+ new String(bytes, StandardCharsets.UTF_8);
|
+ 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);
|
bytes[length] = (byte) "$".charAt(0);
|
||||||
return HexUtils.bytesToHex(bytes);
|
return HexUtils.bytesToHex(bytes);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user