]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
stream: remove bug on from packet path
authorVictor Julien <vjulien@oisf.net>
Wed, 4 Jan 2023 19:39:24 +0000 (20:39 +0100)
committerVictor Julien <vjulien@oisf.net>
Tue, 24 Jan 2023 08:34:23 +0000 (09:34 +0100)
(cherry picked from commit a00db15bd41ad08bec19ad3c252d1aab92c5c525)

src/stream-tcp-list.c

index 940928c64c93cb47dbb23c910c16a5987583790d..9bf4a428753d007a9c52c5e3403aca92f2d10571 100644 (file)
@@ -376,9 +376,9 @@ static int DoHandleDataOverlap(TcpStream *stream, const TcpSegment *list,
 
         const uint8_t *list_data;
         StreamingBufferSegmentGetData(&stream->sb, &list->sbseg, &list_data, &list_len);
-        if (list_data == NULL || list_len == 0)
+        DEBUG_VALIDATE_BUG_ON(list_len > USHRT_MAX);
+        if (list_data == NULL || list_len == 0 || list_len > USHRT_MAX)
             return 0;
-        BUG_ON(list_len > USHRT_MAX);
 
         /* if list seg is partially before base_seq, list_len (from stream) and
          * TCP_SEG_LEN(list) will not be the same */