浏览代码

Add missing NULL termination to the String::repeat function.

bruvzg 5 年之前
父节点
当前提交
8dab067c01
共有 1 个文件被更改,包括 1 次插入0 次删除
  1. 1 0
      core/ustring.cpp

+ 1 - 0
core/ustring.cpp

@@ -3071,6 +3071,7 @@ String String::repeat(int p_count) const {
 	const CharType *src = this->c_str();
 	const CharType *src = this->c_str();
 
 
 	new_string.resize(length() * p_count + 1);
 	new_string.resize(length() * p_count + 1);
+	new_string[length() * p_count] = 0;
 
 
 	for (int i = 0; i < p_count; i++)
 	for (int i = 0; i < p_count; i++)
 		for (int j = 0; j < length(); j++)
 		for (int j = 0; j < length(); j++)