You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by di...@apache.org on 2020/02/28 03:32:32 UTC

[rocketmq-client-cpp] branch master updated: fix(memory): fix the risk of heap-buffer-overflow when ‘OrderTopicConf’ is configured illegally.

This is an automated email from the ASF dual-hosted git repository.

dinglei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/rocketmq-client-cpp.git


The following commit(s) were added to refs/heads/master by this push:
     new b566dec  fix(memory): fix the risk of heap-buffer-overflow when ‘OrderTopicConf’ is configured illegally.
b566dec is described below

commit b566decdaa2ea2630a0b64ef29d6ee8935e6ceea
Author: yizhe.wcm <42...@users.noreply.github.com>
AuthorDate: Fri Feb 28 11:31:51 2020 +0800

    fix(memory): fix the risk of heap-buffer-overflow when ‘OrderTopicConf’ is configured illegally.
---
 src/MQClientFactory.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/MQClientFactory.cpp b/src/MQClientFactory.cpp
index f64818a..cb1a491 100644
--- a/src/MQClientFactory.cpp
+++ b/src/MQClientFactory.cpp
@@ -232,8 +232,8 @@ boost::shared_ptr<TopicPublishInfo> MQClientFactory::topicRouteData2TopicPublish
     for (size_t i = 0; i < brokers.size(); i++) {
       vector<string> item;
       UtilAll::Split(item, brokers[i], ':');
-      int nums = atoi(item[1].c_str());
-      for (int i = 0; i < nums; i++) {
+      size_t nums = (item.size() > 1) ? atoi(item[1].c_str()) : 0;
+      for (size_t i = 0; i < nums; i++) {
         MQMessageQueue mq(topic, item[0], i);
         info->updateMessageQueueList(mq);
       }