clean up sniffer packet overlap issue

This commit is contained in:
John Safranek 2015-08-20 14:48:53 -07:00
parent a93aa8972e
commit 5ce39e147d

View File

@ -2429,7 +2429,10 @@ static int AdjustSequence(TcpInfo* tcpInfo, SnifferSession* session,
/* adjust to expected, remove duplicate */
*sslFrame += overlap;
*sslBytes -= overlap;
/* The following conditional block is duplicated below. It is the
* same action but for a different setup case. If changing this
* block be sure to also update the block below. */
if (reassemblyList) {
word32 newEnd = *expected + *sslBytes;
@ -2461,6 +2464,30 @@ static int AdjustSequence(TcpInfo* tcpInfo, SnifferSession* session,
else if (tcpInfo->fin)
return AddFinCapture(session, real);
}
else {
/* The following conditional block is duplicated above. It is the
* same action but for a different setup case. If changing this
* block be sure to also update the block above. */
if (reassemblyList) {
word32 newEnd = *expected + *sslBytes;
if (newEnd > reassemblyList->begin) {
Trace(OVERLAP_REASSEMBLY_BEGIN_STR);
/* remove bytes already on reassembly list */
*sslBytes -= newEnd - reassemblyList->begin;
}
if (newEnd > reassemblyList->end) {
Trace(OVERLAP_REASSEMBLY_END_STR);
/* may be past reassembly list end (could have more on list)
so try to add what's past the front->end */
AddToReassembly(session->flags.side, reassemblyList->end +1,
*sslFrame + reassemblyList->end - *expected + 1,
newEnd - reassemblyList->end, session, error);
}
}
}
/* got expected sequence */
*expected += *sslBytes;
if (tcpInfo->fin)