From 8116b0de61b22f8d0a1c70d6779870c38f9c6ced Mon Sep 17 00:00:00 2001 From: ruti <> Date: Tue, 15 Oct 2024 20:07:55 +0300 Subject: [PATCH] Fix tlsrec on negative position --- desync.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/desync.c b/desync.c index a239bc9..8c9a44d 100644 --- a/desync.c +++ b/desync.c @@ -481,13 +481,13 @@ ssize_t desync(int sfd, char *buffer, size_t bfsize, for (int i = 0; i < dp.tlsrec_n; i++) { struct part part = dp.tlsrec[i]; - long pos = part.pos + i * 5; - if (pos < 0 || part.flag) { + long pos = i * 5; + pos += gen_offset(part.pos, + part.flag, n - pos, lp, type, host_pos, len); + + if (part.pos < 0 || part.flag) { pos -= 5; } - pos = gen_offset(pos, - part.flag, n, lp, type, host_pos, len); - if (pos < lp) { LOG(LOG_E, "tlsrec cancel: %ld < %ld\n", pos, lp); break;