You've already forked lidgren-network-gen3
mirror of
https://github.com/lidgren/lidgren-network-gen3.git
synced 2026-05-17 15:46:33 +09:00
Fix for possible race condition resulting in duplicate message recycling
Fix for DoS vulnerability with incoming acks
This commit is contained in:
@@ -234,8 +234,11 @@ namespace Lidgren.Network
|
|||||||
{
|
{
|
||||||
//m_peer.LogVerbose("Received ack for " + acktp + "#" + seqNr);
|
//m_peer.LogVerbose("Received ack for " + acktp + "#" + seqNr);
|
||||||
NetSenderChannelBase chan = m_sendChannels[(int)incAck.Item1 - 1];
|
NetSenderChannelBase chan = m_sendChannels[(int)incAck.Item1 - 1];
|
||||||
|
|
||||||
|
// If we haven't sent a message on this channel there is no reason to ack it
|
||||||
if (chan == null)
|
if (chan == null)
|
||||||
chan = CreateSenderChannel(incAck.Item1);
|
continue;
|
||||||
|
|
||||||
chan.ReceiveAcknowledge(now, incAck.Item2);
|
chan.ReceiveAcknowledge(now, incAck.Item2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -138,8 +138,7 @@ namespace Lidgren.Network
|
|||||||
if (storedMessage != null)
|
if (storedMessage != null)
|
||||||
{
|
{
|
||||||
#endif
|
#endif
|
||||||
Interlocked.Decrement(ref storedMessage.m_recyclingCount);
|
if (Interlocked.Decrement(ref storedMessage.m_recyclingCount) <= 0)
|
||||||
if (storedMessage.m_recyclingCount <= 0)
|
|
||||||
m_connection.m_peer.Recycle(storedMessage);
|
m_connection.m_peer.Recycle(storedMessage);
|
||||||
|
|
||||||
#if !DEBUG
|
#if !DEBUG
|
||||||
|
|||||||
Reference in New Issue
Block a user