We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2148ce3 commit 6966688Copy full SHA for 6966688
irr/include/irrString.h
@@ -174,9 +174,8 @@ class string
174
}
175
176
u32 len = calclen(c);
177
- // We must check if the new length is different, otherwise we experience
178
- // a use-after-free. In such a case, we decide whether to resize based
179
- // on it's length.
+ // In case `c` is a pointer to our own buffer, we may not resize first
+ // or it can become invalid.
180
if (len > str.size()) str.resize(len);
181
for (u32 l = 0; l < len; ++l)
182
str[l] = static_cast<T>(c[l]);
0 commit comments