From 45cec80f310c966b63388b18a773533d0e9b9102 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Wed, 3 Aug 2022 16:57:14 -0700 Subject: Fix index usage --- src/main/java/org/traccar/protocol/GalileoProtocolDecoder.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/traccar/protocol/GalileoProtocolDecoder.java b/src/main/java/org/traccar/protocol/GalileoProtocolDecoder.java index d8a753abe..3ff8eb2fb 100644 --- a/src/main/java/org/traccar/protocol/GalileoProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/GalileoProtocolDecoder.java @@ -239,7 +239,7 @@ public class GalileoProtocolDecoder extends BaseProtocolDecoder { private Object decodePositions(Channel channel, SocketAddress remoteAddress, ByteBuf buf) { - int length = (buf.readUnsignedShortLE() & 0x7fff) + 3; + int endIndex = (buf.readUnsignedShortLE() & 0x7fff) + buf.readerIndex(); List positions = new LinkedList<>(); Set tags = new HashSet<>(); @@ -248,7 +248,7 @@ public class GalileoProtocolDecoder extends BaseProtocolDecoder { DeviceSession deviceSession = null; Position position = new Position(getProtocolName()); - while (buf.readerIndex() < length) { + while (buf.readerIndex() < endIndex) { int tag = buf.readUnsignedByte(); if (tags.contains(tag)) { -- cgit v1.2.3