aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnshul Jain <anshuljain1985@gmail.com>2017-08-28 11:15:03 +0530
committerAnshul Jain <anshuljain1985@gmail.com>2017-08-28 11:15:03 +0530
commitb90dfecfdc127d1870f5f61db177f8d63fb9a095 (patch)
tree0952a094d94b44ee68129a29ea2cda6c8da13bcb /src
parent879a25f09033068eb8cb174c1cb3150df594f2e4 (diff)
downloadtraccar-server-b90dfecfdc127d1870f5f61db177f8d63fb9a095.tar.gz
traccar-server-b90dfecfdc127d1870f5f61db177f8d63fb9a095.tar.bz2
traccar-server-b90dfecfdc127d1870f5f61db177f8d63fb9a095.zip
Fix for Gt06 GPS data length can not be greater than 12.
Fix for Alarm packet LBS length skip for 9.
Diffstat (limited to 'src')
-rw-r--r--src/org/traccar/protocol/Gt06ProtocolDecoder.java9
1 files changed, 8 insertions, 1 deletions
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;