Corrects STUN packet length computation as pointed outby Pawel Domas.

This commit is contained in:
chenzo 2012-08-22 09:12:51 +00:00
parent e161411a9b
commit da600aef0c

View File

@ -200,7 +200,9 @@ public class StunDatagramPacketFilter
// field of the STUN header. The message length field of the
// STUN header does not include the 20-byte of the STUN header.
int total_header_length
= ((((int)data[2]) & 0xff) << 8) + (((int) data[3]) & 0xff);
= ((((int)data[2]) & 0xff) << 8)
+ (((int) data[3]) & 0xff)
+ 20;
boolean isHeaderLengthValid = (length == total_header_length);
isStunPacket = areFirstTwoBitsValid && isHeaderLengthValid;