From 5465e58749ecf553839484f4a41ca94a1621bbb8 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Tue, 14 Feb 2017 02:19:31 +1300 Subject: Handle empty AT2000 message (fix #2662) --- src/org/traccar/protocol/At2000ProtocolDecoder.java | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/org/traccar') diff --git a/src/org/traccar/protocol/At2000ProtocolDecoder.java b/src/org/traccar/protocol/At2000ProtocolDecoder.java index 00973f2aa..f990e05c2 100644 --- a/src/org/traccar/protocol/At2000ProtocolDecoder.java +++ b/src/org/traccar/protocol/At2000ProtocolDecoder.java @@ -102,6 +102,10 @@ public class At2000ProtocolDecoder extends BaseProtocolDecoder { return null; } + if (buf.capacity() <= BLOCK_LENGTH) { + return null; // empty message + } + byte[] data = new byte[buf.capacity() - BLOCK_LENGTH]; buf.readBytes(data); buf = ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, cipher.update(data)); -- cgit v1.2.3