@ -298,7 +298,7 @@ Defrag4Reassemble(ThreadVars *tv, DefragTracker *tracker, Packet *p)
if ( frag - > skip )
if ( frag - > skip )
continue ;
continue ;
if ( frag - > data_len - frag - > ltrim < = 0 )
if ( frag - > ltrim > = frag - > data_len )
continue ;
continue ;
if ( frag - > offset = = 0 ) {
if ( frag - > offset = = 0 ) {
@ -779,10 +779,23 @@ DefragInsertFrag(ThreadVars *tv, DecodeThreadVars *dtv, DefragTracker *tracker,
if ( next ! = NULL ) {
if ( next ! = NULL ) {
next = IP_FRAGMENTS_RB_NEXT ( next ) ;
next = IP_FRAGMENTS_RB_NEXT ( next ) ;
}
}
continue ;
insert :
/* If existing fragment has been trimmed up completely
* ( complete overlap ) , remove it now instead of holding
* onto it . */
if ( prev - > skip | | prev - > ltrim > = prev - > data_len ) {
RB_REMOVE ( IP_FRAGMENTS , & tracker - > fragment_tree , prev ) ;
DefragFragReset ( prev ) ;
SCMutexLock ( & defrag_context - > frag_pool_lock ) ;
PoolReturn ( defrag_context - > frag_pool , prev ) ;
SCMutexUnlock ( & defrag_context - > frag_pool_lock ) ;
}
break ;
}
}
}
}
insert :
if ( ltrim > data_len ) {
if ( ltrim > data_len ) {
/* Full packet has been trimmed due to the overlap policy. Overlap
/* Full packet has been trimmed due to the overlap policy. Overlap
* already set . */
* already set . */