Merge bitcoin/bitcoin#29657: Bugfix: bitcoin-cli: Check length of peer.transport_protocol_type

c3e632b441 Bugfix: bitcoin-cli: Check length of peer.transport_protocol_type (Luke Dashjr)

Pull request description:

  "v" would dereference beyond the string length, and "v10" would show as '1'

  Turn both of these cases into a blank, like anything else unexpected currently is.

ACKs for top commit:
  sipa:
    utACK c3e632b441.
  hernanmarino:
    utACK c3e632b441
  alfonsoromanz:
    ACK c3e632b441
  achow101:
    ACK c3e632b441

Tree-SHA512: f641e4412521adae7c8c8e1f268bdaaa223d9048d8286e3df4b13905faaa0d601155ce581cd649f760cab2acc4122356fa94a44714f1f190845552100105eda0
This commit is contained in:
Ava Chow 2024-04-22 18:04:10 -04:00
commit dec74c035b
No known key found for this signature in database
GPG Key ID: 17565732E08E5E41
1 changed files with 1 additions and 1 deletions

View File

@ -551,7 +551,7 @@ public:
peer.is_outbound ? "out" : "in",
ConnectionTypeForNetinfo(peer.conn_type),
peer.network,
peer.transport_protocol_type.starts_with('v') ? peer.transport_protocol_type[1] : ' ',
(peer.transport_protocol_type.size() == 2 && peer.transport_protocol_type[0] == 'v') ? peer.transport_protocol_type[1] : ' ',
PingTimeToString(peer.min_ping),
PingTimeToString(peer.ping),
peer.last_send ? ToString(time_now - peer.last_send) : "",