]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
stream: improve last_ack validation check
authorVictor Julien <vjulien@oisf.net>
Fri, 22 Apr 2022 16:27:15 +0000 (18:27 +0200)
committerVictor Julien <vjulien@oisf.net>
Fri, 22 Apr 2022 16:27:22 +0000 (18:27 +0200)
If a packet after the initialization would come with ACK flag set
but a ACK value of 0, the last_ack tracking could get confused. Fix
this by not checking for 0 but instead checking if the ACK flag
has been seen.

Bug: #4549.

src/stream-tcp-reassemble.h

index 10b229fc2818523085a530b404ca364e8138a036..24ff9f261da36b2375c913cf6da9bf9d129fc94e 100644 (file)
@@ -133,7 +133,7 @@ void StreamTcpReassemblySetMinInspectDepth(TcpSession *ssn, int direction, uint3
 static inline bool STREAM_LASTACK_GT_BASESEQ(const TcpStream *stream)
 {
     /* last ack not yet initialized */
-    if (STREAM_BASE_OFFSET(stream) == 0 && stream->last_ack == 0)
+    if (STREAM_BASE_OFFSET(stream) == 0 && (stream->tcp_flags & TH_ACK) == 0)
         return false;
     if (SEQ_GT(stream->last_ack, stream->base_seq))
         return true;