From 6c0fe165f72a998d447d0983c94e234681a6b680 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Wed, 22 Nov 2017 22:46:13 +1300 Subject: Fix JT600 frame decoder --- src/org/traccar/protocol/Jt600FrameDecoder.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/org/traccar/protocol/Jt600FrameDecoder.java b/src/org/traccar/protocol/Jt600FrameDecoder.java index 5606ae1fc..261f46fe8 100644 --- a/src/org/traccar/protocol/Jt600FrameDecoder.java +++ b/src/org/traccar/protocol/Jt600FrameDecoder.java @@ -1,5 +1,5 @@ /* - * Copyright 2012 - 2016 Anton Tananaev (anton@traccar.org) + * Copyright 2012 - 2017 Anton Tananaev (anton@traccar.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,7 +37,7 @@ public class Jt600FrameDecoder extends FrameDecoder { if (type == '$') { boolean longFormat = buf.getUnsignedByte(buf.readerIndex() + 1) == 0x75; int length = buf.getUnsignedShort(buf.readerIndex() + (longFormat ? 8 : 7)) + 10; - if (length >= buf.readableBytes()) { + if (length <= buf.readableBytes()) { return buf.readBytes(length); } } else if (type == '(') { -- cgit v1.2.3