Unverified 提交 4fead80e authored 作者: José Luis Millán's avatar José Luis Millán 提交者: GitHub

Avoid SRTP leak by deleting invalid SSRCs after STRP decryption (fixe… (#440)

* Avoid SRTP leak by deleting invalid SSRCs after STRP decryption (fixes #437)

* Avoid RtpPacket leak

* Don't remove stream if DecryptSrtp fails

* Don't delete a nullptr RtpPacket
上级 2f88be44
......@@ -594,19 +594,24 @@ namespace RTC
return;
}
// Verify that the packet's tuple matches our tuple.
if (!this->tuple->Compare(tuple))
RTC::RtpPacket* packet = RTC::RtpPacket::Parse(data, len);
if (!packet)
{
MS_DEBUG_TAG(rtp, "ignoring RTP packet from unknown IP:port");
MS_WARN_TAG(rtp, "received data is not a valid RTP packet");
return;
}
RTC::RtpPacket* packet = RTC::RtpPacket::Parse(data, len);
if (!packet)
// Verify that the packet's tuple matches our tuple.
if (!this->tuple->Compare(tuple))
{
MS_WARN_TAG(rtp, "received data is not a valid RTP packet");
MS_DEBUG_TAG(rtp, "ignoring RTP packet from unknown IP:port");
// Remove this SSRC.
RecvStreamClosed(packet->GetSsrc());
delete packet;
return;
}
......
......@@ -785,6 +785,15 @@ namespace RTC
return;
}
RTC::RtpPacket* packet = RTC::RtpPacket::Parse(data, len);
if (!packet)
{
MS_WARN_TAG(rtp, "received data is not a valid RTP packet");
return;
}
// If we don't have a RTP tuple yet, check whether comedia mode is set.
if (!this->tuple)
{
......@@ -792,6 +801,11 @@ namespace RTC
{
MS_DEBUG_TAG(rtp, "ignoring RTP packet while not connected");
// Remove this SSRC.
RecvStreamClosed(packet->GetSsrc());
delete packet;
return;
}
......@@ -823,14 +837,10 @@ namespace RTC
{
MS_DEBUG_TAG(rtp, "ignoring RTP packet from unknown IP:port");
return;
}
// Remove this SSRC.
RecvStreamClosed(packet->GetSsrc());
RTC::RtpPacket* packet = RTC::RtpPacket::Parse(data, len);
if (!packet)
{
MS_WARN_TAG(rtp, "received data is not a valid RTP packet");
delete packet;
return;
}
......
......@@ -1587,6 +1587,10 @@ namespace RTC
case RTC::Producer::ReceiveRtpPacketResult::RETRANSMISSION:
this->recvRtxTransmission.Update(packet);
break;
case RTC::Producer::ReceiveRtpPacketResult::DISCARDED:
// Tell the child class to remove this SSRC.
RecvStreamClosed(packet->GetSsrc());
break;
default:;
}
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论