git-hulk commented on code in PR #2538:
URL: https://github.com/apache/kvrocks/pull/2538#discussion_r1769486574


##########
src/cluster/cluster.cc:
##########
@@ -776,6 +783,13 @@ Status Cluster::parseClusterNodes(const std::string 
&nodes_str, ClusterNodes *no
     for (unsigned i = 5; i < fields.size(); i++) {
       std::vector<std::string> ranges = util::Split(fields[i], "-");
       if (ranges.size() == 1) {
+        std::regex node_id_regex(R"(\b[a-fA-F0-9]{40}\b)");

Review Comment:
   It should be good to only check if `fields[i]` is a node id?



##########
src/cluster/cluster.cc:
##########
@@ -716,6 +716,13 @@ Status Cluster::parseClusterNodes(const std::string 
&nodes_str, ClusterNodes *no
     return {Status::ClusterInvalidInfo, errInvalidClusterNodeInfo};
   }
 
+  for (const auto &entry : nodes_info) {
+    if (entry.find(' ') == std::string::npos) {
+      return {Status::ClusterInvalidInfo,
+              "Invalid nodes definition: Each node entry must contain fields 
separated by spaces."};
+    }
+  }
+

Review Comment:
   ```suggestion
   ```
   
   It has been checked at Line 730.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@kvrocks.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to