summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorHåkon Nessjøen <haakon.nessjoen@gmail.com>2010-10-03 03:46:35 +0200
committerHåkon Nessjøen <haakon.nessjoen@gmail.com>2010-10-03 03:46:35 +0200
commit5025b70fae9ab2d79deac9e08d806a85c339ddbe (patch)
treee2fd40151468fc2eb422361c6a62f9b9a0cc18b0 /main.c
parentfb6540513cdb72f874cdb409e493171c94e59460 (diff)
downloadMAC-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.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/main.c b/main.c
index 545c317..cea231d 100644
--- a/main.c
+++ b/main.c
@@ -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 */