From acccfc75e963bfbb1a0b8b9e9b1a8f19353e3405 Mon Sep 17 00:00:00 2001 From: bol-van Date: Thu, 5 Mar 2026 10:32:26 +0300 Subject: [PATCH] nfqws: backport QUICDefragCrypto --- nfq/protocol.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/nfq/protocol.c b/nfq/protocol.c index 74659ea9..b6122f9f 100644 --- a/nfq/protocol.c +++ b/nfq/protocol.c @@ -888,28 +888,27 @@ bool QUICDefragCrypto(const uint8_t *clean,size_t clean_len, uint8_t *defrag,siz if ((pos+sz)>clean_len) return false; if ((offset+sz)>defrag_data_len) return false; // defrag buf overflow + + // remove exact duplicates early to save cpu + for(i=0;i zeropos) zeropos=offset+sz; - memcpy(defrag_data+offset,clean+pos,sz); - if ((offset+sz) > szmax) szmax = offset+sz; - found=true; - pos+=sz; - - // remove exact duplicates early to save cpu - for(i=0;i szmax) szmax = offset+sz; + memcpy(defrag_data+offset,clean+pos,sz); ranges[range].offset = offset; ranges[range].len = sz; range++; +skip_range: + pos+=sz; } -endloop: } if (found) {