From 37a7a2aacdadcac313e7db5400fe38a03b9f5f9b Mon Sep 17 00:00:00 2001 From: Vinnie Falco Date: Mon, 2 Feb 2015 06:15:21 -0800 Subject: [PATCH] Fix unsafe iterator dereference in PeerFinder --- src/ripple/peerfinder/impl/Logic.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/ripple/peerfinder/impl/Logic.h b/src/ripple/peerfinder/impl/Logic.h index 56bc76760..faf20f50d 100644 --- a/src/ripple/peerfinder/impl/Logic.h +++ b/src/ripple/peerfinder/impl/Logic.h @@ -211,7 +211,7 @@ public: if (result.second) { if (m_journal.debug) m_journal.debug << beast::leftw (18) << - "Logic add fixed" << "'" << name << + "Logic add fixed '" << name << "' at " << remote_address; return; } @@ -230,8 +230,6 @@ public: typename SharedState::Access state (m_state); Slots::iterator const iter (state->slots.find (remoteAddress)); - SlotImp& slot (*iter->second); - if (iter == state->slots.end()) { // The slot disconnected before we finished the check @@ -241,6 +239,7 @@ public: return; } + SlotImp& slot (*iter->second); slot.checked = true; slot.connectivityCheckInProgress = false;