diff options
author | Anton Tananaev <anton@traccar.org> | 2022-09-16 17:55:45 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2022-09-16 17:55:45 -0700 |
commit | 73407e12acce8061cc1aa3d18517569368707864 (patch) | |
tree | c8e2bcd8cb45b6788e910a71eb32e781939a648b /src/main/java/org/traccar/protocol | |
parent | 30e04d7209561b7ebf6055a9170794ab9496c357 (diff) | |
download | trackermap-server-73407e12acce8061cc1aa3d18517569368707864.tar.gz trackermap-server-73407e12acce8061cc1aa3d18517569368707864.tar.bz2 trackermap-server-73407e12acce8061cc1aa3d18517569368707864.zip |
Safer Teltonika IO decoding
Diffstat (limited to 'src/main/java/org/traccar/protocol')
-rw-r--r-- | src/main/java/org/traccar/protocol/TeltonikaProtocolDecoder.java | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/protocol/TeltonikaProtocolDecoder.java b/src/main/java/org/traccar/protocol/TeltonikaProtocolDecoder.java index 89124cb22..ff1f52eb1 100644 --- a/src/main/java/org/traccar/protocol/TeltonikaProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/TeltonikaProtocolDecoder.java @@ -325,6 +325,7 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder { if (codec == CODEC_GH3000) { decodeGh3000Parameter(position, id, buf, length); } else { + int index = buf.readerIndex(); boolean decoded = false; for (var entry : PARAMETERS.getOrDefault(id, new HashMap<>()).entrySet()) { if (entry.getKey() == null || model != null && entry.getKey().contains(model)) { @@ -333,7 +334,9 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder { break; } } - if (!decoded) { + if (decoded) { + buf.readerIndex(index + length); + } else { position.set(Position.PREFIX_IO + id, readValue(buf, length)); } } |