From e705b336df3ae9e03f976e07cf1201bb3327ef2d Mon Sep 17 00:00:00 2001 From: SashaXser <24498484+SashaXser@users.noreply.github.com> Date: Wed, 14 Aug 2024 00:53:45 +0400 Subject: [PATCH] test --- src/Makefile | 29 +++++++++++++++-------------- src/goodbyedpi.c | 7 ++++--- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/src/Makefile b/src/Makefile index 94bd5242..6218b311 100644 --- a/src/Makefile +++ b/src/Makefile @@ -4,27 +4,28 @@ endif WINDIVERTHEADERS = ../../../include WINDIVERTLIBS = ../../binary -MINGWLIB = /usr/$(CPREFIX)/lib/ -MINGWINCLUDE = /usr/$(CPREFIX)/include/ +MINGWLIB = /usr/x86_64-w64-mingw32/lib/ TARGET = goodbyedpi.exe LIBS = -L$(WINDIVERTLIBS) -lWinDivert -lws2_32 +CC = clang --target=$(CPREFIX) --sysroot=/usr/$(CPREFIX) -CC = $(CPREFIX)clang - -CCWINDRES = $(CPREFIX)windres -ifeq (, $(shell which $(CPREFIX)windres)) - CCWINDRES = windres +CCWINDRES = llvm-windres --target=$(CPREFIX) +ifeq (, $(shell which $(CPREFIX)llvm-windres)) + CCWINDRES = llvm-windres endif -CFLAGS = --target=$(CPREFIX) --sysroot=$(MINGWLIB) -std=c99 -fPIE -pipe \ - -I$(WINDIVERTHEADERS) -I$(MINGWINCLUDE) -L$(WINDIVERTLIBS) \ +CFLAGS = -std=c99 -I$(WINDIVERTHEADERS) \ -O3 -march=x86-64-v3 -D_FORTIFY_SOURCE=2 -fstack-protector \ - -Wall -Wextra -Wpedantic -Wformat=2 -Wshadow -Wstrict-aliasing=1 \ - -Wnull-dereference -Wcast-align -Wsign-conversion + -Wall -Wextra -Wpedantic \ + -Wformat-security -Wno-format-nonliteral -Wshadow \ + -Wstrict-aliasing=1 -Wnull-dereference \ + -Wimplicit-fallthrough=3 -Wstringop-overflow=4 \ + -Wformat-signedness -Wstrict-overflow=2 \ + -Wcast-align -Wsign-conversion -LDFLAGS = -fstack-protector -Wl,-O3,-pie,--dynamicbase,--nxcompat,--sort-common,--as-needed \ - -Wl,--disable-auto-image-base +LDFLAGS = -fstack-protector -Wl,-O1,--dynamicbase,--nxcompat,--sort-common,--as-needed \ +-Wl,--disable-auto-image-base ifdef BIT64 LDFLAGS += -Wl,--high-entropy-va -Wl,--pic-executable,-e,mainCRTStartup @@ -50,7 +51,7 @@ goodbyedpi-rc.o: .PRECIOUS: $(TARGET) $(OBJECTS) $(TARGET): $(OBJECTS) - $(CC) $(OBJECTS) $(LDFLAGS) $(LIBS) -s -o $@ + $(CC) $(OBJECTS) $(LDFLAGS) $(LIBS) -o $@ clean: -rm -f *.o utils/*.o diff --git a/src/goodbyedpi.c b/src/goodbyedpi.c index 500e93ad..e4e66f2e 100644 --- a/src/goodbyedpi.c +++ b/src/goodbyedpi.c @@ -974,17 +974,18 @@ int main(int argc, char *argv[]) { if (optarg) { char *autottl_copy = strdup(optarg); + char *autottl_save; if (strchr(autottl_copy, '-')) { // token "-" found, start X-Y parser - char *autottl_current = strtok(autottl_copy, "-"); + char *autottl_current = strtok_r(autottl_copy, "-", &autottl_save); auto_ttl_1 = atoub(autottl_current, "Set Auto TTL parameter error!"); - autottl_current = strtok(NULL, "-"); + autottl_current = strtok_r(NULL, "-", &autottl_save); if (!autottl_current) { puts("Set Auto TTL parameter error!"); exit(ERROR_AUTOTTL); } auto_ttl_2 = atoub(autottl_current, "Set Auto TTL parameter error!"); - autottl_current = strtok(NULL, "-"); + autottl_current = strtok_r(NULL, "-", &autottl_save); if (!autottl_current) { puts("Set Auto TTL parameter error!"); exit(ERROR_AUTOTTL);