From 654fa3e9ed6cc7e03dd51603b6469f3344c12ead Mon Sep 17 00:00:00 2001 From: Mark Herwege Date: Mon, 6 Jun 2022 11:38:50 +0200 Subject: [PATCH] Fix array out of bound exception (#12889) Signed-off-by: Mark Herwege --- .../binding/elroconnects/internal/util/ElroConnectsUtil.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundles/org.openhab.binding.elroconnects/src/main/java/org/openhab/binding/elroconnects/internal/util/ElroConnectsUtil.java b/bundles/org.openhab.binding.elroconnects/src/main/java/org/openhab/binding/elroconnects/internal/util/ElroConnectsUtil.java index 8c6207a7f..0de20f6d2 100644 --- a/bundles/org.openhab.binding.elroconnects/src/main/java/org/openhab/binding/elroconnects/internal/util/ElroConnectsUtil.java +++ b/bundles/org.openhab.binding.elroconnects/src/main/java/org/openhab/binding/elroconnects/internal/util/ElroConnectsUtil.java @@ -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); }