From: Victor Julien Date: Wed, 4 Jan 2023 19:39:24 +0000 (+0100) Subject: stream: remove bug on from packet path X-Git-Tag: suricata-6.0.10~22 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=eb03cdea85654712e9dc94e5c1d98fc4f832faa4;p=thirdparty%2Fsuricata.git stream: remove bug on from packet path (cherry picked from commit a00db15bd41ad08bec19ad3c252d1aab92c5c525) --- diff --git a/src/stream-tcp-list.c b/src/stream-tcp-list.c index 940928c64c..9bf4a42875 100644 --- a/src/stream-tcp-list.c +++ b/src/stream-tcp-list.c @@ -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 */