From d2fe8e560725882769a78aaa952a2f7e87d69177 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Rebelo?= Date: Tue, 16 Nov 2021 21:02:34 +0000 Subject: [PATCH] Sony WH-1000XM3: Fix payload size check --- .../service/devices/sony/wh1000xm3/SonyWh1000Xm3Protocol.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/sony/wh1000xm3/SonyWh1000Xm3Protocol.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/sony/wh1000xm3/SonyWh1000Xm3Protocol.java index 8d60a19e0..1d40f312d 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/sony/wh1000xm3/SonyWh1000Xm3Protocol.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/sony/wh1000xm3/SonyWh1000Xm3Protocol.java @@ -89,9 +89,9 @@ public class SonyWh1000Xm3Protocol extends GBDeviceProtocol { return null; } - int payloadLength = ((message[2] << 24) & 0xFF000000) | ((message[3] << 16) & 0xFF0000) | ((message[4] << 8) & 0xFF00) | ((message[5] << 24) & 0xFF000000); + int payloadLength = ((message[2] << 24) & 0xFF000000) | ((message[3] << 16) & 0xFF0000) | ((message[4] << 8) & 0xFF00) | (message[5] & 0xFF); if (payloadLength != message.length - 7) { - LOG.error("Unexpected payload length {}, expected {}", message.length - 6, payloadLength); + LOG.error("Unexpected payload length {}, expected {}", message.length - 7, payloadLength); return null; }