Browse Source

Merge pull request #41187 from bruvzg/fix_repeat_null_termination

Add missing NULL termination to the String::repeat function.
Rémi Verschelde 5 years ago
parent
commit
abf019d810
1 changed files with 1 additions and 0 deletions
  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++)