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

Ensure messages from packets are expected length and discard otherwis… #339

Merged
merged 3 commits into from
Nov 11, 2015

Conversation

chaviw
Copy link

@chaviw chaviw commented Nov 11, 2015

…e. Discard unknown message types

@chaviw chaviw assigned chaviw and m4gr3d and unassigned chaviw Nov 11, 2015
@@ -44,14 +44,20 @@
final int messageLength = packetBuffer.getInt();
Log.d(TAG, String.format("Received message %d of with value of length %d. Remaining buffer size is %d", messageType, messageLength, packetBuffer.remaining()));

if (messageLength > packetBuffer.remaining()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chaviw stores packetBuffer.remaining() into a variable since it's used more than once.

m4gr3d added a commit that referenced this pull request Nov 11, 2015
Ensure messages from packets are expected length and discard otherwis…
@m4gr3d m4gr3d merged commit 59e35e8 into develop Nov 11, 2015
@m4gr3d m4gr3d deleted the fix_tlv_packet_issues branch November 11, 2015 11:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants