Skip to content
forked from hufrea/byedpi

Commit

Permalink
Merge branch 'hufrea:main' into cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
raspopov authored Aug 29, 2024
2 parents f513a06 + 2e244fd commit 9ec1b46
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions desync.c
Original file line number Diff line number Diff line change
Expand Up @@ -270,13 +270,12 @@ ssize_t send_fake(int sfd, char *buffer,
else {
pkt = cnt != IS_HTTP ? fake_tls : fake_http;
}
size_t psz = pkt.size;
if (opt->fake_offset) {
if (psz > opt->fake_offset) {
psz -= opt->fake_offset;
if (pkt.size > opt->fake_offset) {
pkt.size -= opt->fake_offset;
pkt.data += opt->fake_offset;
}
else psz = 0;
else pkt.size = 0;
}

char path[MAX_PATH], temp[MAX_PATH + 1];
Expand Down Expand Up @@ -306,11 +305,12 @@ ssize_t send_fake(int sfd, char *buffer,
uniperror("CreateEvent");
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");
break;
}
if (psz < pos) {
if (pkt.size < pos) {
if (SetFilePointer(hfile, pos, 0, FILE_BEGIN) == INVALID_SET_FILE_POINTER) {
uniperror("SetFilePointer");
break;
Expand Down Expand Up @@ -341,7 +341,7 @@ ssize_t send_fake(int sfd, char *buffer,
uniperror("SetFilePointer");
break;
}
if (!WriteFile(hfile, buffer, pos, 0, 0)) {
if (!WriteFile(hfile, buffer, pos, &wrtcnt, 0)) {
uniperror("WriteFile");
break;
}
Expand Down
2 changes: 1 addition & 1 deletion main.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#define close(fd) closesocket(fd)
#endif

#define VERSION "13"
#define VERSION "13.1"

char ip_option[1] = "\0";

Expand Down

0 comments on commit 9ec1b46

Please sign in to comment.