From 5f231996d4a1d7fa2c9d7a7453054fcd8f4e2283 Mon Sep 17 00:00:00 2001 From: ValdikSS Date: Wed, 13 Dec 2017 01:42:29 +0300 Subject: [PATCH] Fix incorrect host header memmove()s. Fixes #47 --- goodbyedpi.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/goodbyedpi.c b/goodbyedpi.c index 19950a5..e767332 100644 --- a/goodbyedpi.c +++ b/goodbyedpi.c @@ -513,7 +513,8 @@ int main(int argc, char *argv[]) { /* Move one byte to the LEFT from "Host:" * to the end of User-Agent */ - memmove(host_addr - 1, host_addr, useragent_len); + memmove(host_addr - 1, host_addr, + (PVOID)useragent_addr + useragent_len - (PVOID)host_addr); host_addr -= 1; /* Put space in the end of User-Agent header */ *(char*)((PVOID)useragent_addr + useragent_len - 1) = ' '; @@ -528,7 +529,7 @@ int main(int argc, char *argv[]) { */ memmove((PVOID)useragent_addr + useragent_len + 1, (PVOID)useragent_addr + useragent_len, - useragent_len - 1); + (PVOID)host_addr - 1 - ((PVOID)useragent_addr + useragent_len)); /* Put space in the end of User-Agent header */ *(char*)((PVOID)useragent_addr + useragent_len) = ' '; should_recalc_checksum = 1;