Skip to content

Commit

Permalink
Fix incorrect host header memmove()s. Fixes #47
Browse files Browse the repository at this point in the history
  • Loading branch information
ValdikSS committed Dec 12, 2017
1 parent 81718f1 commit 5f23199
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions goodbyedpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) = ' ';
Expand All @@ -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;
Expand Down

0 comments on commit 5f23199

Please sign in to comment.