We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 216cbfc commit 6e89064Copy full SHA for 6e89064
irr/include/irrString.h
@@ -177,6 +177,9 @@ class string
177
_IRR_DEBUG_BREAK_IF((void *)c == (void *)c_str());
178
179
u32 len = calclen(c);
180
+ // We must check if the new length is different, otherwise we experience
181
+ // a use-after-free. In such a case, we decide whether to resize based
182
+ // on it's length.
183
if (len > str.size()) str.resize(len);
184
for (u32 l = 0; l < len; ++l)
185
str[l] = static_cast<T>(c[l]);
0 commit comments