Browse Source

Fix incorrect host header memmove()s. Fixes #47

pull/48/head 0.1.2rc3
ValdikSS 7 years ago
parent
commit
5f231996d4
  1. 5
      goodbyedpi.c

5
goodbyedpi.c

@ -513,7 +513,8 @@ int main(int argc, char *argv[]) {
/* Move one byte to the LEFT from "Host:" /* Move one byte to the LEFT from "Host:"
* to the end of User-Agent * 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; host_addr -= 1;
/* Put space in the end of User-Agent header */ /* Put space in the end of User-Agent header */
*(char*)((PVOID)useragent_addr + useragent_len - 1) = ' '; *(char*)((PVOID)useragent_addr + useragent_len - 1) = ' ';
@ -528,7 +529,7 @@ int main(int argc, char *argv[]) {
*/ */
memmove((PVOID)useragent_addr + useragent_len + 1, memmove((PVOID)useragent_addr + useragent_len + 1,
(PVOID)useragent_addr + useragent_len, (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 */ /* Put space in the end of User-Agent header */
*(char*)((PVOID)useragent_addr + useragent_len) = ' '; *(char*)((PVOID)useragent_addr + useragent_len) = ' ';
should_recalc_checksum = 1; should_recalc_checksum = 1;

Loading…
Cancel
Save