From eb2697434dbbb8c12cad26df94e3a367880ac4db Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Wed, 22 Jan 2020 23:52:41 -0800 Subject: Fix frame decoding issues --- src/main/java/org/traccar/protocol/OmnicommFrameDecoder.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/main') diff --git a/src/main/java/org/traccar/protocol/OmnicommFrameDecoder.java b/src/main/java/org/traccar/protocol/OmnicommFrameDecoder.java index 1caf6ceb9..314f19757 100644 --- a/src/main/java/org/traccar/protocol/OmnicommFrameDecoder.java +++ b/src/main/java/org/traccar/protocol/OmnicommFrameDecoder.java @@ -27,11 +27,11 @@ public class OmnicommFrameDecoder extends BaseFrameDecoder { protected Object decode( ChannelHandlerContext ctx, Channel channel, ByteBuf buf) throws Exception { - if (buf.readableBytes() < 10) { + if (buf.readableBytes() < 6) { return null; } - int endIndex = buf.getUnsignedShortLE(2) + buf.readerIndex() + 6; + int endIndex = buf.getUnsignedShortLE(buf.readerIndex() + 2) + buf.readerIndex() + 6; if (buf.writerIndex() < endIndex) { return null; } -- cgit v1.2.3