gridcoin-community/Gridcoin-Research

net: guard remaining free-function g_connman dereferences (AddressCurrentlyConnected) (follow-up to #2558)

已關閉

#3,068 建立於 2026年6月15日

 (0 則留言) (0 個反應) (0 位負責人)HTML (179 個分叉)batch import
enhancementgood first issue

倉庫指標

星標
 (575 顆星)
PR 合併指標
 (平均合併 5天 8小時) (30 天內合併 100 個 PR)

描述

Follow-up to #2558.

Gap

Most external g_connman consumers use the established if (g_connman) guard (covering the early-startup / shutdown-teardown window where the unique_ptr is null). One free function still dereferences it unguarded:

  • AddressCurrentlyConnected(const CService& addr)src/net.cpp:337 — calls g_connman->GetAddrMan().Connected(addr) with no guard. Reachable during the shutdown window after g_connman.reset().

Fix

Add the if (g_connman) guard (or route the call through a CConnman member). While here, audit for any other unguarded free-function g_connman dereferences.

Severity

LOW — shutdown-window only; the window is narrow. Good-first-issue-sized hardening.

Note: the other site flagged in the stack review (ConnectNode) is already resolved — it was promoted to a CConnman member in the #2558 stack, so it no longer dereferences g_connman as a free function.

貢獻者指南