diff options
author | Evgeny S Maksimov <admin@vragam.net> | 2019-01-31 12:57:36 +0300 |
---|---|---|
committer | Evgeny S Maksimov <admin@vragam.net> | 2019-01-31 12:57:36 +0300 |
commit | da9e3571f686816c07159fb834ec8b9e6eaa3cda (patch) | |
tree | 39727054f07fc76cad8d76aea9be126622344f6d /src/org/traccar/protocol/NavisFrameDecoder.java | |
parent | 26dc25f0de3c4908425490bcf9e4f854d6598559 (diff) | |
download | trackermap-server-da9e3571f686816c07159fb834ec8b9e6eaa3cda.tar.gz trackermap-server-da9e3571f686816c07159fb834ec8b9e6eaa3cda.tar.bz2 trackermap-server-da9e3571f686816c07159fb834ec8b9e6eaa3cda.zip |
Review fixes
Diffstat (limited to 'src/org/traccar/protocol/NavisFrameDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/NavisFrameDecoder.java | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/org/traccar/protocol/NavisFrameDecoder.java b/src/org/traccar/protocol/NavisFrameDecoder.java index ff367ba77..9a3b3d45c 100644 --- a/src/org/traccar/protocol/NavisFrameDecoder.java +++ b/src/org/traccar/protocol/NavisFrameDecoder.java @@ -44,6 +44,10 @@ public class NavisFrameDecoder extends BaseFrameDecoder { return null; } + if (buf.readableBytes() > MAX_FRAME_LENGTH) { + throw new TooLongFrameException(); + } + if (buf.getByte(buf.readerIndex()) == 0x7F) { // FLEX keep alive frame return buf.readRetainedSlice(1); @@ -51,10 +55,6 @@ public class NavisFrameDecoder extends BaseFrameDecoder { if (protocolDecoder.getFlexDataSize() > 0) { // FLEX frame - if (buf.readableBytes() > MAX_FRAME_LENGTH) { - throw new TooLongFrameException(); - } - if (buf.readableBytes() > FLEX_HEADER_LENGTH) { int length = 0; String type = buf.toString(buf.readerIndex(), 2, StandardCharsets.US_ASCII); @@ -101,9 +101,6 @@ public class NavisFrameDecoder extends BaseFrameDecoder { int length = buf.getUnsignedShortLE(buf.readerIndex() + NTCB_LENGTH_OFFSET); if (buf.readableBytes() >= NTCB_HEADER_LENGTH + length) { - if (buf.readableBytes() > MAX_FRAME_LENGTH) { - throw new TooLongFrameException(); - } return buf.readRetainedSlice(NTCB_HEADER_LENGTH + length); } } |