Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #300 support tcp option data length larger than 128 #301

Open
wants to merge 3 commits into
base: v1
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ private UnknownTcpOption(byte[] rawData, int offset, int length) throws IllegalR

this.kind = TcpOptionKind.getInstance(rawData[offset]);
this.length = rawData[1 + offset];
if (length < this.length) {
if (length < getLengthAsInt()) {
StringBuilder sb = new StringBuilder(100);
sb.append("The raw data is too short to build this option(")
.append(this.length)
Expand All @@ -68,7 +68,7 @@ private UnknownTcpOption(byte[] rawData, int offset, int length) throws IllegalR
throw new IllegalRawDataException(sb.toString());
}

if (this.length > 2) this.data = ByteArrays.getSubArray(rawData, 2 + offset, this.length - 2);
if (this.length > 2) this.data = ByteArrays.getSubArray(rawData, 2 + offset, getLengthAsInt() - 2);
else this.data = new byte[] {};
}

Expand Down