From ca3585a483ca5f6fc4cc54fd1530f89d13e5b7b0 Mon Sep 17 00:00:00 2001 From: John Newbery Date: Tue, 14 Jul 2020 10:24:43 +0100 Subject: [net/net processing] check banman pointer before dereferencing Although we currently don't do this, it should be possible to create a CConnman or PeerLogicValidation without a Banman instance. Therefore always check that banman exists before dereferencing the pointer. Also add comments to the m_banman members of CConnman and PeerLogicValidation to document that these may be nullptr. --- src/net_processing.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/net_processing.h') diff --git a/src/net_processing.h b/src/net_processing.h index 3479ef6865..fa1555fbe6 100644 --- a/src/net_processing.h +++ b/src/net_processing.h @@ -29,6 +29,7 @@ static const int DISCOURAGEMENT_THRESHOLD{100}; class PeerLogicValidation final : public CValidationInterface, public NetEventsInterface { private: CConnman* const connman; + /** Pointer to this node's banman. May be nullptr - check existence before dereferencing. */ BanMan* const m_banman; ChainstateManager& m_chainman; CTxMemPool& m_mempool; -- cgit v1.2.3