From 08b15fddb317107731798fd6e3eb150cc763f275 Mon Sep 17 00:00:00 2001 From: LIBA-S Date: Thu, 8 Aug 2024 15:06:21 +0800 Subject: [PATCH] fix the bug that causes the crash due to the wrong format of the PeerID --- src/braft/cli_service.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/braft/cli_service.cpp b/src/braft/cli_service.cpp index 5f84079d..fc7bde98 100644 --- a/src/braft/cli_service.cpp +++ b/src/braft/cli_service.cpp @@ -233,7 +233,11 @@ butil::Status CliServiceImpl::get_node(scoped_refptr* node, const GroupId& group_id, const std::string& peer_id) { if (!peer_id.empty()) { - *node = global_node_manager->get(group_id, peer_id); + PeerId peer; + if (peer.parse(peer_id) != 0) { + return butil::Status(EINVAL, "Fail to parse %s", peer_id.c_str()); + } + *node = global_node_manager->get(group_id, peer); if (!(*node)) { return butil::Status(ENOENT, "Fail to find node %s in group %s", peer_id.c_str(),