From be99e880523ef1925dda29da89e3efa7b7f99194 Mon Sep 17 00:00:00 2001 From: Cody Cutrer Date: Sat, 9 Feb 2019 15:00:18 -0700 Subject: [PATCH] fix reading encrypted frames that don't line up with network frames we want to call step again if there's remaining data. pos + toWrite is what we consumed from this network frame to complete the encrypted frame. so if it's less than the total network frame (data.length), then call step again. --- .../hap/impl/connections/LengthPrefixedByteArrayProcessor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/beowulfe/hap/impl/connections/LengthPrefixedByteArrayProcessor.java b/src/main/java/com/beowulfe/hap/impl/connections/LengthPrefixedByteArrayProcessor.java index 11cbe6d91..10d456496 100644 --- a/src/main/java/com/beowulfe/hap/impl/connections/LengthPrefixedByteArrayProcessor.java +++ b/src/main/java/com/beowulfe/hap/impl/connections/LengthPrefixedByteArrayProcessor.java @@ -74,7 +74,7 @@ private void step(byte[] data, int pos, Collection results) { results.add(buffer.toByteArray()); buffer.reset(); targetLength = 0; - if (pos + toWrite > data.length) { + if (pos + toWrite < data.length) { step(data, pos + toWrite, results); } } else {