aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_protocol
diff options
context:
space:
mode:
authorAlexander Blair <snipa@jagtech.io>2021-01-03 18:24:50 -0800
committerAlexander Blair <snipa@jagtech.io>2021-01-03 18:24:50 -0800
commitdbaf95ac7716772cfa2463fd8a3e68491f12b2f8 (patch)
treec3498b536de9c2c2da8fea9cf43749ebdf8fc5fa /src/cryptonote_protocol
parentMerge pull request #7268 (diff)
parentfix accessing an network address in a deleted context (diff)
downloadmonero-dbaf95ac7716772cfa2463fd8a3e68491f12b2f8.tar.xz
Merge pull request #7271
4e74385a1 fix accessing an network address in a deleted context (moneromooo-monero)
Diffstat (limited to 'src/cryptonote_protocol')
-rw-r--r--src/cryptonote_protocol/cryptonote_protocol_handler.inl9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/cryptonote_protocol/cryptonote_protocol_handler.inl b/src/cryptonote_protocol/cryptonote_protocol_handler.inl
index c54974387..a3020495e 100644
--- a/src/cryptonote_protocol/cryptonote_protocol_handler.inl
+++ b/src/cryptonote_protocol/cryptonote_protocol_handler.inl
@@ -2835,12 +2835,15 @@ skip:
epee::string_tools::to_string_hex(context.m_pruning_seed) <<
"), score " << score << ", flush_all_spans " << flush_all_spans);
- if (score > 0)
- m_p2p->add_host_fail(context.m_remote_address, score);
-
m_block_queue.flush_spans(context.m_connection_id, flush_all_spans);
+ // copy since dropping the connection will invalidate the context, and thus the address
+ const auto remote_address = context.m_remote_address;
+
m_p2p->drop_connection(context);
+
+ if (score > 0)
+ m_p2p->add_host_fail(remote_address, score);
}
//------------------------------------------------------------------------------------------------------------------------
template<class t_core>