]> git.basschouten.com Git - openhab-addons.git/commitdiff
Fix array out of bound exception (#12889)
authorMark Herwege <mherwege@users.noreply.github.com>
Mon, 6 Jun 2022 09:38:50 +0000 (11:38 +0200)
committerGitHub <noreply@github.com>
Mon, 6 Jun 2022 09:38:50 +0000 (11:38 +0200)
Signed-off-by: Mark Herwege <mark.herwege@telenet.be>
bundles/org.openhab.binding.elroconnects/src/main/java/org/openhab/binding/elroconnects/internal/util/ElroConnectsUtil.java

index 8c6207a7f8b8e41d457a9af4c73744f9bf19da9b..0de20f6d201d1b5ae14179041dafdde623812ed0 100644 (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);
     }