From: Davis McPherson -X (davmcphe - XORIANT CORPORATION at Cisco) Date: Thu, 8 Feb 2024 19:00:05 +0000 (+0000) Subject: Pull request #4180: stream_tcp: add check to verify seglist head is not nullptr and... X-Git-Tag: 3.1.81.0~16 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=609253980b9fb01d75c17c716416196bc3f0dfed;p=thirdparty%2Fsnort3.git Pull request #4180: stream_tcp: add check to verify seglist head is not nullptr and only initialize PAF when it is not Merge in SNORT/snort3 from ~DAVMCPHE/snort3:CSCwi80961_verify_seglist_not_empty to master Squashed commit of the following: commit 9c06b0a65fb09348f660781170de380214f8eea5 Author: davis mcpherson Date: Mon Jan 29 19:09:18 2024 -0500 stream_tcp: add check to verify seglist head is not nullptr and only initialize PAF when it is not --- diff --git a/src/stream/tcp/tcp_reassembler.h b/src/stream/tcp/tcp_reassembler.h index 8dfd0787f..10ecda6c4 100644 --- a/src/stream/tcp/tcp_reassembler.h +++ b/src/stream/tcp/tcp_reassembler.h @@ -56,6 +56,10 @@ public: void skip_midstream_pickup_seglist_hole(TcpReassemblerState&, TcpSegmentDescriptor&); void initialize_paf(TcpReassemblerState& trs) { + // only initialize if we have a data segment queued + if ( !trs.sos.seglist.head ) + return; + if ( !paf_initialized(&trs.paf_state) or SEQ_GT(trs.paf_state.seq, trs.sos.seglist.head->i_seq) ) paf_initialize(&trs.paf_state, trs.sos.seglist.head->i_seq); }