egolearner commented on code in PR #2994: URL: https://github.com/apache/brpc/pull/2994#discussion_r2148965149
########## src/brpc/policy/consistent_hashing_load_balancer.cpp: ########## @@ -71,8 +71,8 @@ bool DefaultReplicaPolicy::Build(ServerId server, replicas->clear(); for (size_t i = 0; i < num_replicas; ++i) { char host[256]; - int len = snprintf(host, sizeof(host), "%s-%lu", - endpoint2str(ptr->remote_side()).c_str(), i); + int len = snprintf(host, sizeof(host), "%s-%lu-%s", Review Comment: 1. with snprintf,no buffer overflow problem. 2. If total length exceeds 256 1. if prefix of tag is different, we will generate a different hash probably 2. if prefix is the same, we will generate the same hash, which should already be handled as hash conflict. In short, no big deal if total length exceeds 256. -- 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: dev-unsubscr...@brpc.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org For additional commands, e-mail: dev-h...@brpc.apache.org