Corrects STUN packet length computation as pointed outby Pawel Domas.
This commit is contained in:
parent
e161411a9b
commit
da600aef0c
@ -200,7 +200,9 @@ public class StunDatagramPacketFilter
|
|||||||
// field of the STUN header. The message length field of the
|
// field of the STUN header. The message length field of the
|
||||||
// STUN header does not include the 20-byte of the STUN header.
|
// STUN header does not include the 20-byte of the STUN header.
|
||||||
int total_header_length
|
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);
|
boolean isHeaderLengthValid = (length == total_header_length);
|
||||||
|
|
||||||
isStunPacket = areFirstTwoBitsValid && isHeaderLengthValid;
|
isStunPacket = areFirstTwoBitsValid && isHeaderLengthValid;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user