diff options
author | Håkon Nessjøen <haakon.nessjoen@gmail.com> | 2010-10-03 03:46:35 +0200 |
---|---|---|
committer | Håkon Nessjøen <haakon.nessjoen@gmail.com> | 2010-10-03 03:46:35 +0200 |
commit | 5025b70fae9ab2d79deac9e08d806a85c339ddbe (patch) | |
tree | e2fd40151468fc2eb422361c6a62f9b9a0cc18b0 /main.c | |
parent | fb6540513cdb72f874cdb409e493171c94e59460 (diff) | |
download | MAC-Telnet-5025b70fae9ab2d79deac9e08d806a85c339ddbe.tar.gz MAC-Telnet-5025b70fae9ab2d79deac9e08d806a85c339ddbe.zip |
Fix invalid counter sizes which would break connection after 65535 bytes of data in one direction
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -40,8 +40,8 @@ int sockfd; int deviceIndex; -int outcounter = 0; -int incounter = 0; +unsigned int outcounter = 0; +unsigned int incounter = 0; int sessionkey = 0; int running = 1; @@ -152,7 +152,7 @@ void handlePacket(unsigned char *data, int data_len) { /* Accept first packet, and all packets greater than incounter, and if counter has wrapped around. */ - if (incounter == 0 || pkthdr.counter > incounter || incounter - pkthdr.counter > 32768) { + if (incounter == 0 || pkthdr.counter > incounter || (incounter - pkthdr.counter) > 65535) { incounter = pkthdr.counter; } else { /* Ignore double or old packets */ |