From 83735fdbb4983a5e0a8813303d2eb9e5445a8616 Mon Sep 17 00:00:00 2001 From: arvidn Date: Sat, 20 May 2017 07:06:11 -0400 Subject: [PATCH] fix NAT-PMP crash when removing a mapping at the wrong time --- ChangeLog | 1 + src/natpmp.cpp | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 3606c4607..5a510743c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,4 @@ + * fix NAT-PMP crash when removing a mapping at the wrong time * improve path sanitization (filter unicode text direction characters) * deprecate partial_piece_info::piece_state * bind upnp requests to correct local address diff --git a/src/natpmp.cpp b/src/natpmp.cpp index dad1a5934..ecf2aff34 100644 --- a/src/natpmp.cpp +++ b/src/natpmp.cpp @@ -279,7 +279,8 @@ void natpmp::try_next_mapping(int i, mutex::scoped_lock& l) std::vector::iterator m = std::find_if( m_mappings.begin(), m_mappings.end() - , boost::bind(&mapping_t::action, _1) != int(mapping_t::action_none)); + , boost::bind(&mapping_t::action, _1) != int(mapping_t::action_none) + && boost::bind(&mapping_t::protocol, _1) != int(none)); if (m == m_mappings.end()) {