From b90dfecfdc127d1870f5f61db177f8d63fb9a095 Mon Sep 17 00:00:00 2001 From: Anshul Jain Date: Mon, 28 Aug 2017 11:15:03 +0530 Subject: Fix for Gt06 GPS data length can not be greater than 12. Fix for Alarm packet LBS length skip for 9. --- src/org/traccar/protocol/Gt06ProtocolDecoder.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/org/traccar') diff --git a/src/org/traccar/protocol/Gt06ProtocolDecoder.java b/src/org/traccar/protocol/Gt06ProtocolDecoder.java index d8da7e6de..dbbaeaf03 100644 --- a/src/org/traccar/protocol/Gt06ProtocolDecoder.java +++ b/src/org/traccar/protocol/Gt06ProtocolDecoder.java @@ -182,6 +182,9 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { } if (length > 0) { + if (length > 12) { + length = 12; + } buf.skipBytes(length - 12); // skip reserved } @@ -202,7 +205,11 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { buf.readUnsignedShort(), buf.readUnsignedByte(), buf.readUnsignedShort(), buf.readUnsignedMedium()))); if (length > 0) { - buf.skipBytes(length - 8); + if (hasLength) { + buf.skipBytes(length - 9); + } else { + buf.skipBytes(length - 8); + } } return true; -- cgit v1.2.3