From 856ed540622ce393bcaba3c4ca4ac97e493eb9fc Mon Sep 17 00:00:00 2001 From: Dmitry Tsarevich Date: Wed, 25 Oct 2023 06:30:10 +0300 Subject: [PATCH] rtcp: Fix check for LengthInWordsMinusOne out of bounds --- Rtp/Rtcp/RtcpHeader.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Rtp/Rtcp/RtcpHeader.cs b/Rtp/Rtcp/RtcpHeader.cs index 537d1129..acf23d1d 100644 --- a/Rtp/Rtcp/RtcpHeader.cs +++ b/Rtp/Rtcp/RtcpHeader.cs @@ -225,7 +225,7 @@ public int LengthInWordsMinusOne /*CheckDisposed();*/ //Write the value - if (value > RtcpHeader.MinimumLengthInWords) throw Binary.CreateOverflowException("LengthInWordsMinusOne", value, ushort.MinValue.ToString(), ushort.MaxValue.ToString()); + if (value < RtcpHeader.MinimumLengthInWords || value > RtcpHeader.MaximumLengthInWords) throw Binary.CreateOverflowException("LengthInWordsMinusOne", value, RtcpHeader.MinimumLengthInWords.ToString(), RtcpHeader.MaximumLengthInWords.ToString()); Binary.Write16(SegmentToLast6Bytes.Array, SegmentToLast6Bytes.Offset, Common.Binary.IsLittleEndian, (ushort)value); }