summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
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 */