From 0dac2a74d30dfc20d7f6c81271ad5ec88b459780 Mon Sep 17 00:00:00 2001 From: orignal Date: Wed, 4 Feb 2015 22:16:44 -0500 Subject: [PATCH] check for duplicate msgID --- TunnelEndpoint.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/TunnelEndpoint.cpp b/TunnelEndpoint.cpp index c9a642be..0ed86e4a 100644 --- a/TunnelEndpoint.cpp +++ b/TunnelEndpoint.cpp @@ -114,9 +114,14 @@ namespace tunnel if (!isFollowOnFragment) // create new incomlete message { m.nextFragmentNum = 1; - auto& msg = m_IncompleteMessages[msgID]; - msg = m; - HandleOutOfSequenceFragment (msgID, msg); + auto ret = m_IncompleteMessages.insert (std::pair(msgID, m)); + if (ret.second) + HandleOutOfSequenceFragment (msgID, ret.first->second); + else + { + LogPrint (eLogError, "Incomplete message ", msgID, "already exists"); + DeleteI2NPMessage (m.data); + } } else {