Merge branch 'hufrea:main' into cmake

This commit is contained in:
Nikolay Raspopov 2024-08-29 23:31:46 +03:00 committed by GitHub
commit 9ec1b464b1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 8 deletions

View File

@ -270,13 +270,12 @@ ssize_t send_fake(int sfd, char *buffer,
else { else {
pkt = cnt != IS_HTTP ? fake_tls : fake_http; pkt = cnt != IS_HTTP ? fake_tls : fake_http;
} }
size_t psz = pkt.size;
if (opt->fake_offset) { if (opt->fake_offset) {
if (psz > opt->fake_offset) { if (pkt.size > opt->fake_offset) {
psz -= opt->fake_offset; pkt.size -= opt->fake_offset;
pkt.data += opt->fake_offset; pkt.data += opt->fake_offset;
} }
else psz = 0; else pkt.size = 0;
} }
char path[MAX_PATH], temp[MAX_PATH + 1]; char path[MAX_PATH], temp[MAX_PATH + 1];
@ -306,11 +305,12 @@ ssize_t send_fake(int sfd, char *buffer,
uniperror("CreateEvent"); uniperror("CreateEvent");
break; break;
} }
if (!WriteFile(hfile, pkt.data, psz < pos ? psz : pos, 0, 0)) { DWORD wrtcnt = 0;
if (!WriteFile(hfile, pkt.data, pkt.size < pos ? pkt.size : pos, &wrtcnt, 0)) {
uniperror("WriteFile"); uniperror("WriteFile");
break; break;
} }
if (psz < pos) { if (pkt.size < pos) {
if (SetFilePointer(hfile, pos, 0, FILE_BEGIN) == INVALID_SET_FILE_POINTER) { if (SetFilePointer(hfile, pos, 0, FILE_BEGIN) == INVALID_SET_FILE_POINTER) {
uniperror("SetFilePointer"); uniperror("SetFilePointer");
break; break;
@ -341,7 +341,7 @@ ssize_t send_fake(int sfd, char *buffer,
uniperror("SetFilePointer"); uniperror("SetFilePointer");
break; break;
} }
if (!WriteFile(hfile, buffer, pos, 0, 0)) { if (!WriteFile(hfile, buffer, pos, &wrtcnt, 0)) {
uniperror("WriteFile"); uniperror("WriteFile");
break; break;
} }

2
main.c
View File

@ -23,7 +23,7 @@
#define close(fd) closesocket(fd) #define close(fd) closesocket(fd)
#endif #endif
#define VERSION "13" #define VERSION "13.1"
char ip_option[1] = "\0"; char ip_option[1] = "\0";