]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
stream: harden tcp reuse check against RST/FIN
authorVictor Julien <vjulien@oisf.net>
Fri, 3 Mar 2023 12:30:55 +0000 (13:30 +0100)
committerVictor Julien <vjulien@oisf.net>
Tue, 28 Mar 2023 12:05:57 +0000 (14:05 +0200)
src/stream-tcp.c

index 0524f8c618b8f591914113231236fd26042a0733..013feac9a02ba6d75bfe588efd2155ac8e33f027 100644 (file)
@@ -5493,6 +5493,10 @@ static inline int StreamTcpValidateChecksum(Packet *p)
  *  \retval bool true/false */
 static int TcpSessionPacketIsStreamStarter(const Packet *p)
 {
+    if (p->tcph->th_flags & (TH_RST | TH_FIN)) {
+        return 0;
+    }
+
     if ((p->tcph->th_flags & (TH_SYN | TH_ACK)) == TH_SYN) {
         SCLogDebug("packet %"PRIu64" is a stream starter: %02x", p->pcap_cnt, p->tcph->th_flags);
         return 1;