Skip to content

Commit

Permalink
Bug fixes.
Browse files Browse the repository at this point in the history
- Fixed incorrect length calculation for the DNS response.
  (Tallow still "worked" despite this bug).
- Add -mno-ms-bitfields flag to work-around bad attribute(packed)
  handling in recent versions of MinGW.
  • Loading branch information
basil00 committed Aug 7, 2015
1 parent 82487d3 commit 1e88781
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Makefile
@@ -1,7 +1,7 @@
CC = i686-w64-mingw32-gcc
WINDRES = i686-w64-mingw32-windres
CFLAGS = --std=c99 -O2 -I contrib/WinDivert-1.2.0-rc-MINGW/include/ -mwindows \
-mthreads -m32 -Wall
-mthreads -mno-ms-bitfields -m32 -Wall
CLIBS = -lws2_32 -lkernel32 -L contrib/WinDivert-1.2.0-rc-MINGW/x86/ \
-lWinDivert -lcomctl32 -mwindows
OBJS = main.o redirect.o domain.o
Expand Down
2 changes: 1 addition & 1 deletion redirect.c
Expand Up @@ -701,7 +701,7 @@ static void handle_dns(HANDLE handle, PWINDIVERT_ADDRESS addr,
size_t len = sizeof(struct dnshdr) + data_len + sizeof(struct dnsa);
if (len > 512) // Max DNS packet size.
return;
len += sizeof(WINDIVERT_IPHDR) + sizeof(WINDIVERT_UDPHDR) + len;
len += sizeof(WINDIVERT_IPHDR) + sizeof(WINDIVERT_UDPHDR);

char buf[len + 8]; // 8 bytes extra.
PWINDIVERT_IPHDR riphdr = (PWINDIVERT_IPHDR)buf;
Expand Down

0 comments on commit 1e88781

Please sign in to comment.