From 3d335b1c6a7b94c0339e8142e4b3a039ef35b7a0 Mon Sep 17 00:00:00 2001 From: Peter Shugalev Date: Mon, 27 Jun 2022 11:22:22 +0400 Subject: [PATCH] Fixed peer version parsing --- src/net_processing.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/net_processing.cpp b/src/net_processing.cpp index a8a14a359f..585bfc902d 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -1443,9 +1443,9 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr if (!vRecv.empty()) { vRecv >> LIMITED_STRING(strSubVer, MAX_SUBVERSION_LENGTH); cleanSubVer = SanitizeString(strSubVer); - int parsedVersion[4]; + int parsedVersion[4] = {0, 0, 0, 0}; if (sscanf(cleanSubVer.c_str(), "/Satoshi:%2d.%2d.%2d.%2d/", - &parsedVersion[0], &parsedVersion[1], &parsedVersion[2], &parsedVersion[3]) == 4) { + &parsedVersion[0], &parsedVersion[1], &parsedVersion[2], &parsedVersion[3]) >= 2) { int peerClientVersion = parsedVersion[0]*1000000 + parsedVersion[1]*10000 + parsedVersion[2]*100 + parsedVersion[3]; if (peerClientVersion < MIN_FIRO_CLIENT_VERSION) { connman.PushMessage(pfrom, CNetMsgMaker(INIT_PROTO_VERSION).Make(NetMsgType::REJECT, strCommand, REJECT_OBSOLETE, "This version is banned from the network"));