nodertc / stun

Low-level Session Traversal Utilities for NAT (STUN) client and server
MIT License
160 stars 29 forks source link

Fingerprint values sometimes aren't set due to negative result from bitwise xor #4

Closed andrewmbenton closed 7 years ago

andrewmbenton commented 7 years ago

Due to the way JavaScript handles bitwise operands, I think the result of xor can be "negative".

This is causing the addFingerprint method to fail intermittently since the value is expected to be a positive integer. Here's the problematic line: https://github.com/reklatsmasters/stun/blob/cb84b7361d651742041f72f1ea247eb808c499e7/lib/message.js#L159

reklatsmasters commented 7 years ago

@andrewmbenton Thanks!