Skip to content

Commit b566dec

Browse files
authored
fix(memory): fix the risk of heap-buffer-overflow when ‘OrderTopicConf’ is configured illegally.
1 parent 12a73b1 commit b566dec

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/MQClientFactory.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,8 @@ boost::shared_ptr<TopicPublishInfo> MQClientFactory::topicRouteData2TopicPublish
232232
for (size_t i = 0; i < brokers.size(); i++) {
233233
vector<string> item;
234234
UtilAll::Split(item, brokers[i], ':');
235-
int nums = atoi(item[1].c_str());
236-
for (int i = 0; i < nums; i++) {
235+
size_t nums = (item.size() > 1) ? atoi(item[1].c_str()) : 0;
236+
for (size_t i = 0; i < nums; i++) {
237237
MQMessageQueue mq(topic, item[0], i);
238238
info->updateMessageQueueList(mq);
239239
}

0 commit comments

Comments
 (0)