From: Victor Julien Date: Mon, 27 Feb 2017 11:27:11 +0000 (+0100) Subject: stream: validate SACK right edge to be in window X-Git-Tag: suricata-4.0.0-beta1~266 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1de1413863d06f9409d756af64a98f5370fef51b;p=thirdparty%2Fsuricata.git stream: validate SACK right edge to be in window --- diff --git a/src/stream-tcp-sack.c b/src/stream-tcp-sack.c index d3be60e920..ab0ad57faa 100644 --- a/src/stream-tcp-sack.c +++ b/src/stream-tcp-sack.c @@ -271,13 +271,12 @@ int StreamTcpSackUpdatePacket(TcpStream *stream, Packet *p) goto next; } - /** \todo need a metric to a check for a right edge limit */ -/* - if (SEQ_GT(ntohl(sack_rec->re), stream->next_seq)) { - SCLogDebug("record beyond next_seq %u", stream->next_seq); + if (SEQ_GT(ntohl(sack_rec->re), stream->next_win)) { + SCLogDebug("record %u:%u beyond next_win %u", + ntohl(sack_rec->le), ntohl(sack_rec->re), stream->next_win); goto next; } -*/ + if (SEQ_GEQ(ntohl(sack_rec->le), ntohl(sack_rec->re))) { SCLogDebug("invalid record: le >= re"); goto next;